Android的 - 删除上卸载SD卡上的文件卡上、文件、Android、SD

2023-09-04 09:29:44 作者:盛开过就凋落

我的应用程序从服务器下载了一些多媒体文件,它的安装时。我这样做是为了节省应用程序的大小空间。然而,这种方法的缺点是,当该应用被卸载时,它不删除这些文件。我看到报道说,这是可能的,但我似乎无法使它发挥作用。有没有办法做到这一点上卸载,或者我应该只是忘了这件事?

My app downloads some multi-media files from a server when it's installed. I do this to save space on the size of the app. However, the drawback of this approach is that when the app is uninstalled, it doesn't delete those files. I've seen reports that this is possible, but I can't seem to make it work. Is there a way to do this on uninstall, or should I just forget about it?

请注意,我已经安装在SD卡上默认,以及应用程序,但我不知道是否所有的手机都将自动支持。

Note that I have the app installed on the SD card by default as well, but I'm not sure if all phones will automatically support this.

推荐答案

你能不能下载的文件,并将其写入使用方法,内部空间在这里解释这些应用程序:的内部存储

Could you download the files and write them to the apps internal space using the methods explained here : Internal Storage

写入内部存储器中的文件,当用户卸载应用程序将被自动删除。

Files written to the internal storage are automatically removed when the user uninstalls your application.

这是我读过的Andr​​oid不允许修改卸载过程中,以帮助防止恶意软件。

From what I've read Android does not allow you to modify the uninstall process to help protect against malware.

与Android 2.2开始(API 8级)的应用程序可以安装在SD卡的

Starting with Android 2.2 (API level 8) apps can be installed on the sdcard.

在这里看到更多的信息:安装应用程序到SD卡

See here for more info : Installing to application to sd card

编辑:显然也有一个外部缓存,您可以使用,根据该文档被当用户卸载你的应用程序也被删除:的外部缓存

Edit : apparently there is also an external cache that you can use that, according to the doc gets removed when the user uninstalls your app also : External cache