废话不多说了,直接给大家贴代码了,具体代码如下所示; private void checkOldPackage() { String packageName = "xxx.xxx.xxx.xxx"; if (isAvilibl
废话不多说了,直接给大家贴代码了,具体代码如下所示;
private void checkOldPackage() { String packageName = "xxx.xxx.xxx.xxx"; if (isAvilible(this, packageName)) { Intent uninstall_intent = new Intent(); uninstall_intent.setAction(Intent.ACTION_DELETE); uninstall_intent.setData(Uri.parse("package:" + packageName)); startActivity(uninstall_intent); } } private boolean isAvilible(Context cxt, String packagename) { PackageManager pm = cxt.getPackageManager(); List<PackageInfo> pinfo = pm.getInstalledPackages(0); for (int i = 0; i < pinfo.size(); i++) { if (pinfo.get(i).packageName.equalsIgnoreCase(packagename)) { return true; } } return false; }
--结束END--
本文标题: Android 删除指定包名的App实例代码
本文链接: https://lsjlt.com/news/221918.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0