Android移除桌面捷径 [英] Android-remove desktop shorcut

查看:106
本文介绍了Android移除桌面捷径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户从主应用程序删除桌面快捷方式时,如何使android应用程序删除桌面快捷方式我如何制作一个当用户从移动设备删除主应用程序时由自己删除桌面的android应用程序

how to make the android application remove desktop shortcut when user delete it from main How can i make an android application that when the user delete the main application from mobile it delete by herself the desktop

推荐答案

意图捷径Intent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
shortcutIntent.setClassName(this,this.getClass().getName());
最终Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
intent.setAction("com.android.launcher.permission.UNINSTALL_SHORTCUT");
注意清单文件中的NB使用卸载快捷方式的权限
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
shortcutIntent.setClassName(this, this.getClass().getName());
final Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.setAction("com.android.launcher.permission.UNINSTALL_SHORTCUT");
NB in manifest file use permission to uninstall shortcut


这篇关于Android移除桌面捷径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆