androidandroid-6.0-marshmallow

If storage permission is changed manually from android 6.0 will the database (SQLiteOpenHelper) be dropped?


If the storage permission is manually turned off, will the table created be dropped and will all the data that has been stored be deleted?

I'm really confused because when I manually turn off the storage permission and then launch my app again and accept the storage permission, all the data that has been stored from my table becomes empty.


Solution

  • The storage permission on Android only affects external storage. Your database should be stored in the app's private directory and you do not need any permissions to read/write in there.

    When you deny a permission manually, the app is stopped by the system. You may not be persisting some data and it's lost when the app is stopped, check your flow when writing to the database.