blePermission static method
蓝牙权限
Implementation
static Future<bool> blePermission() async {
//await Permission.contacts.shouldShowRequestRationale;
if (await Permission.bluetoothScan.status.isDenied) {
//判断是否被永久拒绝
if (await Permission.bluetoothScan.status.isPermanentlyDenied) {
return openAppSettings();
}
var request = await Permission.bluetoothScan.request();
if (request.isDenied) {
return request.isGranted;
}
}
if (await Permission.bluetooth.status.isDenied) {
if (await Permission.bluetooth.status.isPermanentlyDenied) {
return openAppSettings();
}
var request = await Permission.bluetooth.request();
if (request.isDenied) {
return request.isGranted;
}
}
if (await Permission.bluetoothConnect.status.isDenied) {
if (await Permission.bluetoothConnect.status.isPermanentlyDenied) {
return openAppSettings();
}
var request = await Permission.bluetoothConnect.request();
if (request.isDenied) {
return request.isGranted;
}
}
return locationPermission();
}