Android shortcut issue

73 Views Asked by At

I am creating a Shortcut icon with the following code which is working on my device.

Intent shortcutIntent = new Intent(getApplicationContext(),
                AlertActivity.class);
        shortcutIntent.setAction(Intent.ACTION_MAIN);

        Intent addIntent = new Intent();
        addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
        addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "ss");
        addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                Intent.ShortcutIconResource.fromContext(getApplicationContext(),
                        R.drawable.sss));
        addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
        addIntent.putExtra("duplicate", false);  //may it's already there so   don't duplicate
        getApplicationContext().sendBroadcast(addIntent);

Now I am trying to upload my application to the play store for some of the devices this icon is not creating.

Note: I am facing this issue with Nexus 6, Android 7.1.1. What could be the issue here

Here this code is working even with the signed apk.

Please someone help me to solve this.

0

There are 0 best solutions below