I create a shortcut by sending this broadcast.
Intent shortcutIntent = new Intent(this, AuthenticationActivity.class);
final Intent intent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, widget.name);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(this, widget.resourceId));
sendBroadcast(intent);
I am wondering if there is a way to find out if the broadcast was received by the launcher? I show a toast to the user, saying that the shortcut was created successfully, but some launchers may not support this.
source
share