简体   繁体   English

在卸载Android 2.3时擦除应用程序外部文件

[英]Erase app external files on uninstall Android 2.3

I've use the Android method Context.getExternalFilesDir() and save some data from my app on a external file. 我使用了Android方法Context.getExternalFilesDir()并将我的应用程序中的一些数据保存在外部文件中。 So far, when I uninstall the app on an Android 4.4, this external files are being erased as well, but this is not the case for Android 2.3. 到目前为止,当我在Android 4.4上卸载该应用程序时,此外部文件也将被删除,但Android 2.3并非如此。

I was wondering if this is possible and if so, how would I achieve this kind of behavior in Android 2.3. 我想知道这是否可能,如果可以,我将如何在Android 2.3中实现这种行为。

Regards Jose 问候何塞

4.4 changed the behavior for the SD card. 4.4更改了SD卡的行为。 Prior to that, data on the SD card had no protections, any app could read or write anywhere. 在此之前,SD卡上的数据没有保护,任何应用都可以在任何地方读取或写入。 Afterwards, files and directories were protected so only the app that created them could read or write them. 之后,文件和目录受到保护,因此只有创建它们的应用程序才能读取或写入它们。 Because 2.3 doesn't track who owns the files, it can't delete them when uninstalling. 由于2.3不会跟踪文件的所有者,因此在卸载时无法删除它们。 The closest thing you could do is delete the files yourself on a regular basis. 您可以做的最接近的事情就是定期自己删除文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM