如何删除通过卸载应用程序创建的文件?应用程序、文件

2023-09-12 01:15:23 作者:马可菠萝包

我创建了创建和存储文件到SD卡的应用程序。有没有办法与程序的文件夹绑定,以删除所有文件,当用户运行卸载的Andr​​oid设备?

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?

推荐答案

有没有办法为你的应用程序知道它正在被卸载(不修改内核)。在数据/数据​​/ your.app.package创建的所有文件会自动安装时被删除。

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.

我觉得没有什么是从SD卡清除。你可以做一个简单的测试,发现了这一点。

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.

 
精彩推荐
图片推荐