Closed Zvirtuey closed 3 years ago
could you show us the entire code or reproducible example?
I found the reason, I want to apply for permission when I enter the interface,If you add this, it will appear !!!
@Override protected void onResume() { super.onResume(); LoginActivityPermissionsDispatcher.showCameraWithPermissionCheck(this); }
@OnNeverAskAgain(Manifest.permission.CAMERA) public void showNeverAskForCamera() { Log.w(getActivityTag(), "go setting"); showSettingDialog();
}
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { // NOTE: delegate the permission handling to generated method super.onRequestPermissionsResult(requestCode, permissions, grantResults); Log.i(getActivityTag(), " call onRequestPermissionsResult "); LoginActivityPermissionsDispatcher.onRequestPermissionsResult(this, requestCode, grantResults);
}
Logcat: 09-17 10:33:36.178 21161-21161/com.rzt.newborn W/LoginActivity: go setting 09-17 10:33:36.568 21161-21161/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-17 10:33:36.569 21161-21161/com.rzt.newborn W/LoginActivity: go setting 09-17 10:33:37.019 21161-21161/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-17 10:33:37.021 21161-21161/com.rzt.newborn W/LoginActivity: go setting 09-17 10:33:37.471 21161-21161/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-17 10:33:37.472 21161-21161/com.rzt.newborn W/LoginActivity: go setting 09-17 10:33:37.956 21161-21161/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-17 10:33:37.957 21161-21161/com.rzt.newborn W/LoginActivity: go setting
Don't call permission request inside onResume. This is not from the library but Android framework itself.
see: https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/323
version 4.8.0
When you choose never ask again, onRequestPermissionsResult !!! this method calls back all the time. Seriously affect my program, is there any solution, I can manually stop or other methods?
logcat:
09-15 15:06:01.143 14220-14220/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-15 15:06:01.224 14220-14220/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-15 15:06:01.315 14220-14220/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-15 15:06:01.376 14220-14220/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-15 15:06:01.440 14220-14220/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-15 15:06:01.509 14220-14220/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-15 15:06:01.577 14220-14220/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-15 15:06:01.644 14220-14220/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult 09-15 15:06:01.746 14220-14220/com.rzt.newborn I/LoginActivity: call onRequestPermissionsResult