How to forget the "Never ask again" choice in Android M runtime permission dialog
Both clearing data (Settings > Apps > your app > Storage > Clear Data) and uninstalling the app clear the status of this flag, along with clearing everything else related to runtime permissions for the app.
This behavior was tested on a Nexus 5 running Android 6.0, via this sample app.
I seem to recall seeing a manual option for this somewhere, but I can't find it now. It may be something that existed back in the M Developer Preview releases and got pulled for the final 6.0 release.
You can "forget" it by clearing the data from app's settings.
EDIT: As @me_ pointed out, just clearing app data may not reset the "don't ask again" condition in some devices. In such cases manually turning on and then turning off the permissions from app's settings will do the trick.
But if you want to find if a permission has been set not to request again you can check it programatically by using the onRequestPermissionsResult()
method.
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
for(String permission: permissions){
if(ActivityCompat.shouldShowRequestPermissionRationale(this, permission)){
//denied
}else{
if(ActivityCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED){
//allowed
} else{
//set to never ask again
Log.e("set to never ask again", permission);
}
}
}
}
PS: I have answered full implementation at this answer.
Found it:
System Settings > Apps > Reset App Preferences (in the menu)