Since Runtime Permissions were introduced in Android Marshmallow, I've been meaning to apply the new way for requesting permissions and I've read and understood the dangerous permissions and how to check for them and request them.
The question is, If I have an
Do I check and request the permission when the Activity is opened? Or when the button is clicked?
If the only purpose of the
Activity is to take a picture when the button is clicked, I would request the permission when the activity is opened.
Activity has other roles, such that the take-a-picture button is only one feature out of many, I would ask for the permission when the user clicks the button.
In other words, once the user has requested to go down a path that will (almost) certainly need the permission, ask for the permission.