Android application self-uninstall

14,030

Solution 1

You can Remove your App using Intent.ACTION_DELETE

try this it work for me

 Intent intent = new Intent(Intent.ACTION_DELETE);
     intent.setData(Uri.parse("package:" + this.getPackageName()));
     startActivity(intent);

Solution 2

No you simply can't. At least not for the phones that are not rooted. You can take the user to an Uninstall screen, but they would have to click on "Uninstall" to uninstall the app. For more information visit install/uninstall application programmatically.

Share:
14,030
Hazneliel
Author by

Hazneliel

Sr Mobile Developer

Updated on July 29, 2022

Comments

  • Hazneliel
    Hazneliel almost 2 years

    Is there a way to make an application uninstall itself? For example: I want to be able to click on an "Uninstall" button in my app and have the the app uninstall itself.

    I can imagine that you can call a function of the firmware and delegate the action to it so the app gets uninstalled.

    The reason I need this is that when the app is uninstalled I need to delete some files on the sdcard that were downloaded by the app.

  • jeet.chanchawat
    jeet.chanchawat over 11 years
    it takes the user to Uninstall screen.
  • Darren Christopher
    Darren Christopher about 7 years
    Hi, I know I am super late, but do you know how to uninstall the app automatically? (i.e. no need confirmation from user)
  • Umer Softwares
    Umer Softwares almost 4 years
    This permission will be required in API level 28 and above. <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />