Andrew Hubbs
Andrew Hubbs

Reputation: 9426

In Android, can you delete an application from another application?

If I have two applications loaded on an Android device, are there calls I can make in one that will delete the other one? I am looking for something to delete apps in a fashion similar to how I can launch an app from another.

I thought this may be possible through the Intent/Activity interactions but it doesn't seem possible. This seems like something that may not be allowed for obvious reasons but wanted to check anyways.

Follow up question, can an application remove itself?

Upvotes: 2

Views: 5420

Answers (2)

Chris Stratton
Chris Stratton

Reputation: 40357

You cannot complete the removal without user approval, but you can use an intent to bring up a screen where they can confirm the removal:

<manifest ...>
 <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES"/>
 ...
</manifest>
Uri packageURI = Uri.parse("package:"+"some.package.to.remove");
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(uninstallIntent);

Upvotes: 22

hunterp
hunterp

Reputation: 15976

There are apps like quick uninstaller that speed up the delete process, you'll probably need to find an Intent that deletes the app, because the user still needs to have the final say over this.

Upvotes: 0

Related Questions