I am seeking to copy my SQLite database to "external" storage as a means of backing up my database file. From there the user can grab the .db file and move to a place deemed safe.
In following the Android Developer documentation on getting permission to WRITE_EXTERNAL_STORAGE, I have entered the code shown in verbatim and I stepped through it with the debugger. (I changed the READ_CONTACTS to WRITE_EXTERNAL_STORAGE)
It will first checkSelfPermission and skip shouldShowRequestPermissionRationale going to requestPermissions. I'm then given an alert popup asking for my permission.
If I deny it, it will then, on the second run through, go to checkSelfPermission again and then go to shouldShowRequestPermissionRationale but skip requestPermissions and terminate not asking for permission again as the Android documentation says it should.
My Questions:
- Am I supposed to add a call to requestPermissions in the shouldShowRequestPermissionRationale if() block to get it to ask again? Or is there another way?
- If I want to explain the reason or rational for why the permission is needed, am I supposed to implement my own AlertDialog box? Or is there a set method to the ask again AlertBox I haven't discovered yet to provide the system with my explanation?
So far everything I have done in the writing of this app has been a learning experience. I'm having a great time.
EDIT: I do have the
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
set in my Manafest.