如何在安装后自动创建快捷方式?下面的代码不起作用!如何在安装后自动创建快捷方式?
private void createShortCut() {
Intent intent = new Intent(ACTION_INSTALL_SHORTCUT);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
intent.putExtra("duplicate", false);
Parcelable icon = Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.icon);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);//icon
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(getApplicationContext() , MainActivity.class));
setResult(RESULT_OK, intent);
sendBroadcast(intent);
}
你检查过[这一个](http://stackoverflow.com/questions/6337431/android-create-shortcuts-on-the-home-screen) – 2012-04-12 11:59:00