gpt4 book ai didi

android - 如何检测主屏幕中的快捷方式

转载 作者:可可西里 更新时间:2023-11-01 18:45:48 26 4
gpt4 key购买 nike

我有一个应用程序可以让您在主屏幕中创建“快捷方式”。但是我可以检测到“快捷方式”是否已经存在,我不必再次创建它。谢谢。

最佳答案

我遇到了同样的问题。我认为您无法判断它是否存在,但我认为我使用的方法也对您有用。

只需在添加之前卸载快捷方式即可!

intent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(intent);

intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(intent);

只需确保将以下内容添加到 list 文件即可。

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

关于android - 如何检测主屏幕中的快捷方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4668396/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com