My app requires to access CAMERA and WRITE_EXTERNAL_STORAGE permissions.
Once my app loads I want to ask user to allow both of these permissions one after another. I have this code:
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
}
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1);
}
Now once my app loads it asks for the first permission but never asks for the second until I reload the entire app again.
How do I ask both of these permissions from the user once app loads?