sty*_*972 10
我遇到了同样的问题.我不认为它可能会告诉你它是否存在,但我认为我用过的东西也适合你.
只需在添加快捷方式之前卸载快捷方式!
intent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(intent);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(intent);
Run Code Online (Sandbox Code Playgroud)
只需确保将以下内容添加到清单文件中即可.
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
Run Code Online (Sandbox Code Playgroud)
我不知道是否可以检测到快捷方式,但是不是卸载然后安装,而是可以使用Extra字段作为
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, appName);
...
intent.putExtra("duplicate", false);
...
sendBroadcast(intent);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9610 次 |
| 最近记录: |