静默安装和卸载经验:
- 静默卸载:
String appPackage ="被卸载应用的包名";
Intent intent = new Intent(mContext, mContext.getClass());
PendingIntent sender = PendingIntent.getActivity(mContext, 0, intent,0);
PackageInstaller mPackageInstaller = mContext.getPackageManager().getPackageInstaller();
mPackageInstaller.uninstall(appPackage, sender.getIntentSender());
上面为调用PackageInstaller接口实现静默卸载的简单源码。
需要新建一个文件名为