Unable To Create Application's Shortcut On Home Screen Upon Installation In Android
I want to create a shortcut of the application on home screen when it is installed. I added this to AndroidManifest.xml Copy
Also apply following permissions in your AndroidManifest.xml
<uses-permissionandroid:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
Hope this will work for you
Solution 2:
IntentshortcutIntent=newIntent(Intent.ACTION_MAIN);
shortcutIntent.setClassName(this, this.getClass().getName());
Intentintent=newIntent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "hello");
ParcelableiconResource= Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
intent.setAction(Intent.ACTION_CREATE_SHORTCUT);
getApplicationContext().sendBroadcast(intent);
Post a Comment for "Unable To Create Application's Shortcut On Home Screen Upon Installation In Android"