if (pinfo.get(i).packageName.equalsIgnoreCase(packageName)) { //判断 要卸的包 是否存在 Intent uninstall_intent = new Intent(); uninstall_intent.setAction(Intent.ACTION_DELETE);//设置action为卸载已安装的包 uninstall_intent.setData(Uri.parse("package:" + packageName));//设置 startActivity(uni...
Java documentation forandroid.content.Intent.ACTION_UNINSTALL_PACKAGE. Portions of this page are modifications based on work created and shared by theAndroid Open Source Projectand used according to terms described in theCreative Commons 2.5 Attribution License. ...
1,注册BroadcastReceiver,监听"android.intent.action.PACKAGE_REMOVED"系统广播 结果:NO。未写代码,直接分析,卸载的第一步就是退出当前应用的主进程,而此广播是在已经卸载完成后才发出的,此时主进程都没有了,去哪onReceive()呢? 2,若能收到"将要卸载XX包"的系统广播,在主进程被退出之前就抢先进行反馈处理就好了...
Uri packageUri = Uri.parse("package:" + packageName); Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri); uninstallIntent.putExtra(Intent.EXTRA_UNINSTALL_ALL_USERS, allUsers); mMetricsFeatureProvider.action( mActivity, SettingsEnums.ACTION_SETTINGS_UNINSTALL_APP); mFr...
我们可以使用以下代码构造一个卸载Intent: StringpackageName="com.example.app";// 对应要卸载的包名IntentuninstallIntent=newIntent(Intent.ACTION_DELETE);uninstallIntent.setData(Uri.parse("package:"+packageName)); 1. 2. 3. 3. 启动卸载流程
}/*卸载apk*/publicstaticvoiduninstallApk(Context context, String packageName) { Uri uri= Uri.parse("package:" +packageName); Intent intent=newIntent(Intent.ACTION_DELETE, uri); context.startActivity(intent); } 通过发一个Intent,把应用所在的路径封装整uri.之后默认启动了PackageInstaller.apk来安装程...
通过Intent卸载APP在安卓9.0手机上没反应,也没报错,卸载相关APP跳转到卸载页面代码 fun unInstallApp(packageName: String) { val uri: Uri = Uri.fromParts("package", packageName, null) val intent = Intent(Intent.ACTION_DELETE, uri) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ...
Intent it = new Intent(Intent.ACTION_VIEW,URI); startActivity(it); 5.拨打电话 Java代码 Uri uri = Uri.parse("tel:xxxxxx"); Intent it = new Intent(Intent.ACTION_DIAL, uri); startActivity(it); [color=blue]//要使用这个必须在配置文件中加入<uses-permission id="android .permission.CALL_PH...
Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); 11.install apk Java代码 Uri installUri = Uri.fromParts("package", "xxx", null); returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri); 12.uninstall apk ...
public class UninstallReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_PACKAGE_REMOVED)) { String packageName = intent.getData().getSchemeSpecificPart(); if (packageName.equals(context.getPackageName()...