Onkar
Onkar

Reputation: 43

How do I remove any app from a device using my app in android?

I am doing some experiments on my device - I want to be able to remove any application from an Android device using my application.

Given the package name of an app, how can I force the user to go to that package's uninstaller page in the Manage Applications widget?

Thanks.

Upvotes: 2

Views: 2184

Answers (2)

Paresh Mayani
Paresh Mayani

Reputation: 128428

This may be helpful to you:

Uri packageURI = Uri.parse("package:com.android.myapp");
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(uninstallIntent);

For more and detailed information regarding the installation and uninstallation, read this question: install / uninstall APKs programmatically (PackageManager vs Intents)

Upvotes: 6

Joe
Joe

Reputation: 2659

Give this a try:

Uri AppToDelete = Uri.parse("package:" + [PACKAGE NAME GOES HERE]);
Intent RemoveApp = new Intent(Intent.ACTION_DELETE, AppToDelete);
startActivity(RemoveApp);

Upvotes: 3

Related Questions