0

I'm about to launch my first app in a week,and want to know if google play automatically adds the shortcut to the home-screen or is it something if have to do with code. I have question like this but there's nothing about creating shortcut on install.

Community
  • 1
  • 1
pavitran
  • 814
  • 1
  • 10
  • 25

4 Answers4

1

I launched my app found that Google Play does automatically creates a shortcut on the homescreen and we don't have to do it in our code,although i don't know if it works the same way in Amazon app store. hope this helps someone who is trying to find answer to the same question.

pavitran
  • 814
  • 1
  • 10
  • 25
1

Mohit Madaan's answer was correct. Just don't forget to set duplicate to false otherwise you might have several shortcuts:

addIntent.putExtra("duplicate", false);
0

put this permission in manifest

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

below for creating the shortcut icon on android Homescreen

private void ShortcutIcon(){

Intent shortcutIntent = new Intent(getApplicationContext(), MainActivity.class);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Test");
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.ic_launcher));
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(addIntent);}
Mohit Madaan
  • 469
  • 2
  • 11
0

I came across this and I hope this helps you. http://viralpatel.net/blogs/android-install-uninstall-shortcut-example/

Mew
  • 1,132
  • 2
  • 10
  • 19