我在google play上有一个应用。一旦用户下载并安装,google将自动创建一个home screen widgets (google >设置->Auto被选中)。由于一些技术上的原因,我想避免这种创作。
是否可以通过编程(通过清单或任何其他选项)来避免自动创建主屏幕小部件?
如有任何答复,将不胜感激,谢谢。
发布于 2013-08-28 07:54:57
删除Android中的快捷方式使用意图(UNINSTALL_SHORTCUT)来执行任务。
因此,首先将此权限添加到您的清单中:
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />在java代码中
private void removeShortcut() {
//Deleting shortcut for MainActivity
//on Home screen
Intent shortcutIntent = new Intent(getApplicationContext(),MainActivity.class);
shortcutIntent.setAction(Intent.ACTION_MAIN);
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "HelloWorldShortcut");
addIntent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(addIntent);}
所以现在你可以在你的第一次发射时调用它(如果你有任何的话,可能是在你的启动屏幕加载的时候)。现在取决于您如何使用这个:)
想了解更多信息..。http://viralpatel.net/blogs/android-install-uninstall-shortcut-example/ https://gist.github.com/zeuxisoo/1008973
https://stackoverflow.com/questions/18481907
复制相似问题