我希望在某些条件匹配时以编程方式在运行时卸载我的应用。可能吗?我已经读过这篇文章,但它没有用。
Intent intent = new Intent(Intent.ACTION_DELETE, Uri.fromParts("package",
getPackageManager().getPackageArchiveInfo(apkUri.getPath(), 0).packageName,null));
startActivity(intent);
答案 0 :(得分:0)
包裹
后你错过了:
public static void launchUnInstaller(Context ctx, String packageName) {
try {
Uri packageURI = Uri.parse("package:" + packageName);
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
ctx.startActivity(uninstallIntent);
} catch (Exception ex) {
Log.e(TAG,e.toString);
}
}