Android - Preserve or delete files created by the application on uninstall

后端 未结 6 1920
别跟我提以往
别跟我提以往 2020-11-29 05:52

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 uninsta

6条回答
  •  执念已碎
    2020-11-29 06:19

    it seems since then there is a proper soltuion, Context.getExternalFilesDir():

    Returns the absolute path to the directory on the external filesystem (that is somewhere on Environment.getExternalStorageDirectory()) where the application can place persistent files it owns. These files are private to the applications, and not typically visible to the user as media.

    This is like getFilesDir() in that these files will be deleted when the application is uninstalled

提交回复
热议问题