How to delete a folder when user selects uninstall my application in android

后端 未结 2 752
猫巷女王i
猫巷女王i 2020-12-19 11:47

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 l

2条回答
  •  忘掉有多难
    2020-12-19 12:10

    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.

    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.

提交回复
热议问题