As you know when you long press on the home screen, the phone shows up a list menu. You can add shortcuts, widgets, Folders, etc. I would like my app to be in the shortcut list.
How can I do that?
That functionality is already there by default, they just have to choose from the "Applications" list. You can't add directly to the main shortcuts list (it would get far too cluttered quickly), that's provisioned by the operating system and to my knowledge cannot be populated by a third party application.
Shortcuts had existed since API level 1, and can be used by 3rd party apps as well.
To add an activity to the shortcuts manu simply add this intent filter to your activity in your manifest:
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
To make the activity plant a new icon with an intent on the home screen, do this before finishing:
Intent intent = new Intent();
Intent launchApp = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchApp);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "My shortcut");
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, myIcon);
setResult(RESULT_OK, intent);
Change the launchApp
intent to whatever you want launched when this is clicked.
See here: http://developer.android.com/reference/android/content/Intent.html#ACTION_CREATE_SHORTCUT
来源:https://stackoverflow.com/questions/11439253/add-my-app-to-the-add-shortcut-list-to-have-a-shortcut-on-homescreen