Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Bug #334

Open
Zvirtuey opened this issue Sep 17, 2020 · 0 comments
Open

Bug #334

Zvirtuey opened this issue Sep 17, 2020 · 0 comments

Comments

@Zvirtuey
Copy link

I want to apply for permission when I enter the interface,If you add this, If you click don't ask me again,it will appear !!!
There are the same problems about PermissionsDispatcher
permissions-dispatcher/PermissionsDispatcher#690

@OverRide
protected void onResume() {
super.onResume();
goLogin();
}

private void goLogin() {
if (passNumber == null) {
passNumber = new AtomicInteger(0);
} else {
passNumber.set(0);
}
//LoginActivityPermissionsDispatcher.showCameraWithPermissionCheck(this);
rxPermissions
.requestEach(Manifest.permission.CAMERA,
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.RECORD_AUDIO,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE)
.subscribe(permission -> { // will emit 2 Permission objects
if (permission.granted) {
// permission.name is granted !
Log.i(getActivityTag(), " pass " + permission.name);
passNumber.incrementAndGet();
if (passNumber.get() == 5) {
Log.i(getActivityTag(), "all pass");
}
} else if (permission.shouldShowRequestPermissionRationale) {
Log.d(getActivityTag(), " never ask " + permission.name);
// Denied permission without ask never again
passNumber.set(0);
} else {
// Denied permission with ask never again
// Need to go to the settings
showWaringDialog();
}
});
}

Logcat:

09-17 10:48:21.670 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA
09-17 10:48:21.671 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_PHONE_STATE
09-17 10:48:21.823 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.WRITE_EXTERNAL_STORAGE
09-17 10:48:21.823 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_EXTERNAL_STORAGE
09-17 10:48:21.836 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA
09-17 10:48:21.836 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_PHONE_STATE
09-17 10:48:22.023 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.WRITE_EXTERNAL_STORAGE
09-17 10:48:22.023 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_EXTERNAL_STORAGE
09-17 10:48:22.038 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA
09-17 10:48:22.038 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_PHONE_STATE
09-17 10:48:22.203 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.WRITE_EXTERNAL_STORAGE
09-17 10:48:22.204 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_EXTERNAL_STORAGE
09-17 10:48:22.221 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA
09-17 10:48:22.221 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_PHONE_STATE
09-17 10:48:22.391 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.WRITE_EXTERNAL_STORAGE
09-17 10:48:22.391 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_EXTERNAL_STORAGE
09-17 10:48:22.409 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA
09-17 10:48:22.410 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_PHONE_STATE
09-17 10:48:22.603 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.WRITE_EXTERNAL_STORAGE
09-17 10:48:22.603 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_EXTERNAL_STORAGE
09-17 10:48:22.621 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA
09-17 10:48:22.621 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_PHONE_STATE
09-17 10:48:22.818 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.WRITE_EXTERNAL_STORAGE
09-17 10:48:22.818 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_EXTERNAL_STORAGE
09-17 10:48:22.835 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA
09-17 10:48:22.835 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_PHONE_STATE
09-17 10:48:23.117 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.WRITE_EXTERNAL_STORAGE
09-17 10:48:23.118 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_EXTERNAL_STORAGE
09-17 10:48:23.141 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA
09-17 10:48:23.141 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_PHONE_STATE
09-17 10:48:23.467 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.WRITE_EXTERNAL_STORAGE
09-17 10:48:23.467 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_EXTERNAL_STORAGE
09-17 10:48:23.486 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA
09-17 10:48:23.486 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_PHONE_STATE
09-17 10:48:23.710 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.WRITE_EXTERNAL_STORAGE
09-17 10:48:23.711 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.READ_EXTERNAL_STORAGE
09-17 10:48:23.765 27864-27864/com.rzt.newborn I/LoginActivity: pass android.permission.CAMERA

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant