详情见:Android 静默安装和静默卸载(系统层)
http://blog.csdn.net/zhouyuanjing/article/details/78507606
安装:
Intent intent = new Intent("android.intent.action.SILENT_PACKAGE_INSTALL");
intent.putExtra("silent_install_file", "/sdcard/Helloworld.apk");
intent.putExtra("silent_install_auto_start", true);//是否安装并启动
intent.putExtra("silent_install_start_clazz", "com.example.helloworld.MainActivity");//如果安装并启动,则需指定activityName
sendBroadcast(intent);
卸载:
Intent intent = new Intent("android.intent.action.SILENT_PACKAGE_DELETE");
intent.putExtra("silent_delete_package", "com.example.helloworld");//指定需要卸载apk的包名
sendBroadcast(intent);
2021-05-28 16:43:54
104KB
静默安装卸载
1