Я думаю, что перепробовал все решения, которые нашел в интернете, но никто не работал - нет сил близко, но на рабочем столе ничего не появляется.
Теперь у меня есть это:
private void createShortcutOnDesktop(Application app) {
Intent shortcutIntent = new Intent();
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, app.getIntentShortcut());
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, app.getName());
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.drawable.home_button));
shortcutIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
this.sendBroadcast(shortcutIntent);
finish();
}
app.getIntentShortcut()
:
public Intent getIntentShortcut() {
Intent i = new Intent();
i.setClassName(packageName, name);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
return i;
}
И в файле AndroidManifest.xml
:
<permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
Чего мне не хватает?Спасибо.