react-native-ble-manager
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -23,2 +23,14 @@ 'use strict'; | ||
readRSSI(peripheralId) { | ||
return new Promise((fulfill, reject) => { | ||
bleManager.readRSSI(peripheralId, (error, rssi) => { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
fulfill(rssi); | ||
} | ||
}); | ||
}); | ||
} | ||
write(peripheralId, serviceUUID, characteristicUUID, data, maxByteSize) { | ||
@@ -25,0 +37,0 @@ if (maxByteSize == null) { |
{ | ||
"name": "react-native-ble-manager", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "A BLE module for react native.", | ||
@@ -5,0 +5,0 @@ "main": "BleManager", |
@@ -64,2 +64,5 @@ # react-native-ble-manager | ||
``` | ||
##Note | ||
Android API >= 23 require the ACCESS_COARSE_LOCATION permission to scan for peripherals. | ||
React Native >= 0.33 natively support PermissionsAndroid like in the example. | ||
@@ -74,3 +77,5 @@ ##Basic Example | ||
TouchableHighlight, | ||
NativeAppEventEmitter | ||
NativeAppEventEmitter, | ||
Platform | ||
PermissionsAndroid | ||
} from 'react-native'; | ||
@@ -96,2 +101,18 @@ import BleManager from 'react-native-ble-manager'; | ||
.addListener('BleManagerDiscoverPeripheral', this.handleDiscoverPeripheral ); | ||
if (Platform.OS === 'android' && Platform.Version >= 23) { | ||
PermissionsAndroid.checkPermission(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => { | ||
if (result) { | ||
console.log("Permission is OK"); | ||
} else { | ||
PermissionsAndroid.requestPermission(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => { | ||
if (result) { | ||
console.log("User accept"); | ||
} else { | ||
console.log("User refuse"); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -98,0 +119,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82191426
84006
524