Android: Как удалить / удалить ярлыки приложений с главного экрана?
Я пытался (ДОБАВИТЬ, а затем) УДАЛИТЬ мое приложениеs ярлык с домашнего экрана. Добавление ярлыка работает отлично, но яя не могу удалить ярлык ямы создали с использованием кода ниже.
public void setupShortCut(boolean create) {
shortcutIntent = new Intent();
shortcutIntent.setClassName("com.abc.xyz", "XYZActivity");
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
icon = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);
Intent intentShortcut = new Intent();
intentShortcut.putExtra("android.intent.extra.shortcut.INTENT", shortcutIntent);
intentShortcut.putExtra("android.intent.extra.shortcut.NAME", getResources().getString(R.string.app_name));
intentShortcut.putExtra("android.intent.extra.shortcut.ICON_RESOURCE", icon);
if(create) {
intentShortcut.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
} else {
intentShortcut.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
}
sendBroadcast(intentShortcut);
}
Пожалуйста, предложите, где я иду не так?
РЕДАКТИРОВАТЬ 1:
Мне нужно разрешение в моем файле манифеста: