You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`Handle service binding and starting
if (hasPermissions()) {
startOrBindService()
}
private fun hasPermissions() :Boolean {
if (EasyPermissions.hasPermissions(this, *permissions.toTypedArray())) {
return true
}
else{
val permsToRequest = mutableListOf<String>()
val rationaleMessages = mutableListOf<String>()
// Check which permissions are missing and need to be requested
for (perm in permissions) {
if (!EasyPermissions.hasPermissions(this, perm)) {
permsToRequest.add(perm)
// Add rationale messages for missing permissions
when (perm) {
ACCESS_FINE_LOCATION -> rationaleMessages.add(getString(R.string.permission_location_rationale))
RECORD_AUDIO -> rationaleMessages.add(getString(R.string.permission_record_audio_rationale))
POST_NOTIFICATIONS -> rationaleMessages.add(getString(R.string.permission_notifications_rationale))
}
}
}
EasyPermissions.requestPermissions(
this,
rationaleMessages.joinToString("\n\n"),
REQUEST_CODE_PERMISSIONS,
*permsToRequest.toTypedArray()
)
return false
}
}
override fun onPermissionsDenied(requestCode: Int, perms: List<String>) {
setupViews()
setSlidersProperties()
setPausePlayImage()
}
override fun onPermissionsGranted(requestCode: Int, perms: List<String>) {
if (EasyPermissions.hasPermissions(this, *permissions.toTypedArray())) {
if (!isServiceBound)
startOrBindService()
else {
mIsPaused = mSharedPref.getBoolean(KEY_IS_PAUSED, true)
setupViews()
setSlidersProperties()
setPausePlayImage()
}
}
}
`
First time opening the app, android permissions request appear.
Denying the permissions raise the easypermission rationale.
Clicking Ok in the dialog, raises the Android permissions requests again.
Denying permission again will not raise the rationale ever again even when app is restarted and haspermission() called again.
If Cancel button is pressed in the dialog it just closes the rationale and it will keep appearing.
I would expect the following behavior:
First time opening the app, rationale appears
Cancel button pressed: No permission requests shown. Ok button pressed: pemission requests shown.
Denying the permissions raises the easypermission rationale again everytime.
Code and logs
// TODO(you): show the code that produces the problem,
// and any relevant logs.
The text was updated successfully, but these errors were encountered:
in onCreate():
`
First time opening the app, android permissions request appear.
Denying the permissions raise the easypermission rationale.
Clicking Ok in the dialog, raises the Android permissions requests again.
Denying permission again will not raise the rationale ever again even when app is restarted and haspermission() called again.
If Cancel button is pressed in the dialog it just closes the rationale and it will keep appearing.
I would expect the following behavior:
First time opening the app, rationale appears
Cancel button pressed: No permission requests shown. Ok button pressed: pemission requests shown.
Denying the permissions raises the easypermission rationale again everytime.
Code and logs
The text was updated successfully, but these errors were encountered: