A12 permission
This commit is contained in:
parent
afea158d0e
commit
a487fea21e
1 changed files with 4 additions and 2 deletions
|
@ -97,14 +97,16 @@ class AndroidPermission @Inject constructor(
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun notifyForBtConnectPermission(activity: FragmentActivity) {
|
fun notifyForBtConnectPermission(activity: FragmentActivity) {
|
||||||
activity.startActivity(Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE))
|
|
||||||
if (Build.VERSION.SDK_INT >= /*Build.VERSION_CODES.S*/31) {
|
if (Build.VERSION.SDK_INT >= /*Build.VERSION_CODES.S*/31) {
|
||||||
// Manifest.permission.BLUETOOTH_CONNECT
|
// Manifest.permission.BLUETOOTH_CONNECT
|
||||||
if (permissionNotGranted(activity, "android.permission.BLUETOOTH_CONNECT") || permissionNotGranted(activity, "android.permission.BLUETOOTH_SCAN")) {
|
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)
|
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")) }
|
notification.action(R.string.request) { askForPermission(activity, arrayOf("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT")) }
|
||||||
rxBus.send(EventNewNotification(notification))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue