From a487fea21e097fddf44f005a2afc6db0f094e8ae Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 15 Dec 2021 18:14:13 +0100 Subject: [PATCH] A12 permission --- .../info/nightscout/androidaps/utils/AndroidPermission.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt index e0b5d12414..e69156470b 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt @@ -97,14 +97,16 @@ class AndroidPermission @Inject constructor( @Synchronized fun notifyForBtConnectPermission(activity: FragmentActivity) { - activity.startActivity(Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)) if (Build.VERSION.SDK_INT >= /*Build.VERSION_CODES.S*/31) { // Manifest.permission.BLUETOOTH_CONNECT if (permissionNotGranted(activity, "android.permission.BLUETOOTH_CONNECT") || permissionNotGranted(activity, "android.permission.BLUETOOTH_SCAN")) { val notification = NotificationWithAction(injector, Notification.PERMISSION_BT, rh.gs(R.string.needconnectpermission), Notification.URGENT) notification.action(R.string.request) { askForPermission(activity, arrayOf("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT")) } rxBus.send(EventNewNotification(notification)) - } else rxBus.send(EventDismissNotification(Notification.PERMISSION_BT)) + } else { + activity.startActivity(Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)) + rxBus.send(EventDismissNotification(Notification.PERMISSION_BT)) + } } }