Is there any way to uninstall an app from my app?I have tried like below but app crashed with exception.
Uri packageUri = Uri.parse(items.get(
Integer.parseInt(v.getTag().toString())).getPname());
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri);
startActivity(uninstallIntent);
Logcat:-
11-01 11:14:35.781: E/AndroidRuntime(3834): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.DELETE dat=com.android.gesture.builder }
Thanks in advance
To Delete application you must know the package name of the Application.
Uri packageURI = Uri.parse("package:com.android.myapp");
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(uninstallIntent);
Edit :
Uri packageUri = Uri.parse("package:"+items.get(
Integer.parseInt(v.getTag().toString())).getPname());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.