Android - Preserve or delete files created by the application on uninstall

后端 未结 6 1952
别跟我提以往
别跟我提以往 2020-11-29 05:52

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 uninsta

6条回答
  •  甜味超标
    2020-11-29 06:34

    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 application uninstall.

    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.

提交回复
热议问题