views:

374

answers:

2

Hi,

I created an application which creates and stores files to sdcard. Is there a way to bind the folder with application in order to delete all files when the user runs uninstall on android device?

A: 

There may be an easier way, but what I bet you'll have to do is create a Custom Action for your installer that runs on uninstall and deletes the folder. Your program will need to somehow store information telling the uninstaller what folders to clean up, then your custom action just does a delete on all of the folders your program told it to.

EDIT: I was just informed in a comment that this is an Android question. I missed that. However, I'll leave my answer because maybe there is something like custom actions for installers on Android. I have removed my Microsoft link though.

Max Schmeling
wait the question is tagged Android and you have a Microsoft link... did I miss something?
Johan
I missed that. Edited my answer.
Max Schmeling
+2  A: 

There's no way for your application to know that it is being uninstalled (without modifying the kernel). All files created in the data/data/your.app.package is deleted automatically upon install.

I don't think anything is cleared from the sdcard. You can do a quick test and find that out.

Another approach could be to have another application that checks whether this application is installed or not. If not, it can do the clean-up work.

Prashast