Uninstall Android application yourself

Is there a way to uninstall the application myself? For example: I want to be able to click the "Delete" button in my application and delete the application.

I can imagine that you can call the firmware function and delegate the action to it so that the application is deleted.

The reason I need it is because when I delete the application, I need to delete some files on the SD card downloaded by the application.

+6
source share
3 answers

You can remove your application using Intent.ACTION_DELETE

try it will work for me

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

No, you just can't. At least not for phones that are not implemented. You can take the user to the Uninstall screen, but they will need to click "Uninstall" to uninstall the application. For more information, visit programmatically install / uninstall the application.

+3
source

Unfortunately, you cannot uninstall the application or even discover that your application is being deleted. This is necessary to maintain security and prevent malware.

I suggest that you use internal storage instead of using an SD card to store files. These files are automatically deleted when the application is uninstalled.

http://developer.android.com/guide/topics/data/data-storage.html#filesInternal

-1
source

Source: https://habr.com/ru/post/911951/


All Articles