1

I have create shortcut icon on home of another application using code:

Intent shortcutIntent = new Intent(context,
                        list.get(i).activityInfo.applicationInfo.name.getClass());
shortcutIntent.setAction(Intent.ACTION_MAIN);
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME,                            manager.getApplicationLabel(list.get(i).activityInfo.applicationInfo));
                addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
                Parcelable icon = Intent.ShortcutIconResource.fromContext(context, R.mipmap.ic_launcher);
                addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
                context.sendBroadcast(addIntent);

I am unable to start that application on shortcut icon click on home.

0 Answers0