Because the Android SDK 23 gives users the possibility to deny apps access to certain functionalities I wanted to update one of my apps to request permissions as it is described in here: https://developer.android.com/preview/features/runtime-permissions.html.
In one of the activities I embed a SupportMapFragment. To make it work you need to have the WRITE_EXTERNAL_STORAGE
permission, so I request it when I start the activity which results in a creation of a permission request dialog.
Now the problem is that when the dialog is still open and I rotate the device the activity will be restarted and open a new permission request dialog while the old one is still there. The result is two of those dialogs on top of each other and only one of it being useful.
Is there a way to get rid of the dialog that was started first?
boolean
in your saved instance stateBundle
indicating that the permission request is outstanding, and do not re-request the permission. Or, wait to request the permission until some form of user input (e.g., tapping on the action bar item that launches theSupportMapFragment
), in which case you should be safe, as the user cannot tap on that item again while the dialog is visible. – Toni