How do I Create Shortcut on android?

  • Hi all,

    I would know if it' s possible create a shortcut using Cordova plugin or something.

    I would create a shortcut on android devices, I ' ve used this java code to do that usinf native java apps.

    [quote:1av3bbvh]public void createShortCut(){

    Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");

    shortcutintent.putExtra("duplicate", false);

    shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcutname));

    Parcelable icon = Intent.ShortcutIconResource.fromContext(getApplicationContext, R.drawable.icon);

    shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);

    shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(getApplicationContext, EnterActivity.class));

    sendBroadcast(shortcutintent);

    }

    Also I ' ve added permissions on manifest.xml

    [quote:1av3bbvh]<uses-permission

    android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

    <uses-permission

    android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />

    Thanks and greetens

    David

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)