如何当用户选择卸载我的Andr​​oid应用程序删除文件夹我的、应用程序、文件夹、用户

2023-09-12 10:22:08 作者:凉了时光空了旧城

我想知道如何删除文件夹,一旦用户选择卸载按钮,我的应用程序。 我想它以编程方式有没有可能做到这一点? 如果是的话让我知道它可能的解决方案。 在此先感谢。

I would like to know about how to delete a folder once user select uninstall button for my application. I want it by programmatically is there any chance to do it... If so let me know possible solution for it. thanks in advance.

推荐答案

如果您创建的任何文件夹上的设备的外部存储......有没有办法让你当用户卸载你的应用程序调用code。有些事情是自动删除(数据库,任何写入内部存储容量),而不是文件夹上的外部存储。

If you created any folders on a device's external storage... there is no way for you to call code when the user uninstalls your app. Certain things are removed automatically (databases, anything written to Internal Storage), but not folders on external storage.

编辑 - 正如史蒂芬,如果你的目标API级别8或更高版本,可以使用Context.getExternalFilesDir()为您的外部文件,这些将在卸载删除

EDIT - As pointed out by Stephan, if you are targeting API Level 8 or higher, you can use Context.getExternalFilesDir() for your external files and those will be removed on uninstall.

 
精彩推荐
图片推荐