如何删除通过卸载应用程序创建的文件? [英] How to delete files created by the application on uninstall?

查看:117
本文介绍了如何删除通过卸载应用程序创建的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了创建和存储文件到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.

这篇关于如何删除通过卸载应用程序创建的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆