mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-01-20 08:07:31 +01:00
EN: Fix permission granting on Android 11
This commit is contained in:
parent
1d747f6a83
commit
a0558a5f38
@ -118,14 +118,26 @@ class ExposureNotificationsConfirmActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun requestPermissions() {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
requestPermissions(permissions, ++permissionRequestCode)
|
||||
when {
|
||||
Build.VERSION.SDK_INT >= 30 -> requestPermissions(
|
||||
permissions.toSet().minus("android.permission.ACCESS_BACKGROUND_LOCATION").toTypedArray(), ++permissionRequestCode
|
||||
)
|
||||
Build.VERSION.SDK_INT >= 23 -> requestPermissions(permissions, ++permissionRequestCode)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode == this.permissionRequestCode) checkPermissions()
|
||||
if (requestCode == this.permissionRequestCode) {
|
||||
when {
|
||||
Build.VERSION.SDK_INT >= 30 && permissions.contains("android.permission.ACCESS_FINE_LOCATION") ->
|
||||
requestPermissions(
|
||||
arrayOf("android.permission.ACCESS_BACKGROUND_LOCATION"),
|
||||
++permissionRequestCode
|
||||
)
|
||||
else -> checkPermissions()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bluetooth
|
||||
|
Loading…
x
Reference in New Issue
Block a user