1

I am using the following method:

private void placeShortcutIcon(){

    Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + mAppData.packageName));
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, mAppData.title);

    Intent.ShortcutIconResource shortcutIconResource = Intent.ShortcutIconResource.fromContext(MainApplication.getAppContext(), R.drawable.ic_launcher);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIconResource);
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");

    MainApplication.getAppContext().sendBroadcast(addIntent);
}

Is there be any potential problems when installing a shortcut from an IntentService?

JY2k
  • 2,879
  • 1
  • 31
  • 60

0 Answers0