Possible Duplicate:
Android create shortcuts on the home screen
I want to create a shortcut of my android application on home screen as soon as my application is installed in an android device. How do I do this..?
Possible Duplicate:
Android create shortcuts on the home screen
I want to create a shortcut of my android application on home screen as soon as my application is installed in an android device. How do I do this..?
as Answer by @Kailash :
You can use below code it worked for me:
Intent shortcutIntent = new Intent();
shortcutIntent.setClassName("WRITE YOUR PACKAGE NAME", "WRITE HERE YOUR CLASS NAME");
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "WRITE HERE YOUR SHORTCUT NAME");
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(context, R.drawable.icon));
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
context.sendBroadcast(addIntent);
You have to use following permission in your AndroidManaifest.xml
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
Hope it Helps.