android 删除桌面的快捷键shortcut

本文介绍如何在Android系统中删除特定的应用快捷方式(shortcut),并提供了一个示例代码,展示了删除名为Sample的快捷方式的具体步骤。此外,还介绍了如何创建指向网页的快捷方式,并附带了相关权限设置。

只能删除shortcut类型的,不能删除Application的icon类型的,比如删除api demo 的 shortcut private String DELETE_ACTION = "com.android.launcher.action.UNINSTALL_SHORTCUT";
Intent intent = new Intent(DELETE_ACTION);

intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Sample");

ComponentName comp = new ComponentName("com.example.android.apis",

"com.example.android.apis.app.LauncherShortcuts");


intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent()

.setComponent(comp).setAction("android.intent.action.MAIN"));

sendBroadcast(intent);
加permission

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

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

在数据库中红色是有效的数据intent. putExtra("",new Intent(
"android.intent.action.VIEW").setData(Uri.parse("http://www.google.com/"))
9       Google  http://www.google.com/#Intent;action=android.intent.action.VIEW;S.com.android.browser.application_id=-376878250900917176;

intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Google");
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(
"android.intent.action.VIEW").setData(Uri.parse("http://www.google.com/")));
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值