grantespo :
In API >= 23, we are required to ask users for permission at run-time. But for some reason, the permissions are causing onResume to be called infinitely. What causes this?
@Override
protected void onResume() {
super.onResume();
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.ANYPERMISSION},1);
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
}
Tomasz Czura :
When you show dialog of permission question, Acitvity goes to onPause
, and when dialog hides, it goes to onResume
. You have to change place of asking of permission.
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=437381&siteId=1