react-native-beacons-manager
react-native-beacons-manager copied to clipboard
Ranging iBeacons not detected.
Version
1.0.6
Platform
Android
OS version
android 7.1
Steps to reproduce
- I have installed demo app
const subscription = DeviceEventEmitter.addListener(
'beaconsDidRange',
(data) => {
console.log(data.beacons) - Array of all beacons inside a region
}
);
Expected behavior
beacons aarray should include my beacon
Actual behavior
beacons array is empty
Hi,
It is an old version.
Is there any reason why you don't use v1.0.7 in your app?
I'm currently working on a HUGE (for Android) update with v1.1.0 in master branch.
On Android, I can range multiple types of beacons
(iBeacon, eddyStone...) - tested these days.
Please have a try with the master branch version just to be sure it does not come from something else.
@MacKentoch - is the new (Android) version suppose to include support for detection when the app is killed (https://github.com/Estimote/Android-SDK/issues/62#issuecomment-342522028)
I am having the same problem (no beacons showing up for ranging) with Android. I have not tried on iOS, as my app is exclusively Android. I tried updating to the master branch version and experienced the crash on launch issue that other people have been having. More importantly I looked at the small amount of log I got before the crash and I noticed the exact same behavior as before: beaconsDidRange is being called, but no beacons despite the clear and measurable presence of beacons. I was also using 1.0.7, so I don't think it's a version issue.
What did seem curious is that, although I did apply an identifier to my ranging, the android log output seemed unaware of ids for the region:
D/BeaconsAndroidModule: rangingConsumer didRangeBeaconsInRegion, region: id1: null id2: null id3: null
That could be normal, but it would make sense that if no regions are ranging then no beacons would result. I also noticed:
D/BluetoothLeScanner: could not find callback wrapper
For context, here is the code that I am using from start to finish (more or less):
import Beacons from 'react-native-beacons-manager';
const region = {
uuid: '...',
identifier: '1'
}
Beacons.detectIBeacons()
Beacons.startMonitoringForRegion(region).then(() => {
console.log('Started monitoring', region);
}).catch((error) => {
console.log('Failed to start monitoring!', error);
});
Beacons.startRangingBeaconsInRegion(region.identifier, region.uuid).then(() => {
console.log('Started ranging');
DeviceEventEmitter.addListener('beaconsDidRange', (data) => {
console.log(data);
});
}).catch((error) => {
console.log('Failed to range');
console.log(error);
});
For both monitoring and ranging it logs successfully starting both. For clarity I tried without a UUID for ranging as well, with the same result
Here are the permissions in the AndroidManifest.xml:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Update: I noticed that the monitoring does work, more or less, but I need ranging as well. If anyone has had this issue I would greatly appreciate knowing how you fixed it
@johnlev I have the same issue :(. Could you solve the problem?
Hi,
It is an old version.
Is there any reason why you don't use v1.0.7 in your app?
I'm currently working on a HUGE (for Android) update with v1.1.0 in master branch. On Android, I can range
multiple types of beacons
(iBeacon, eddyStone...) - tested these days.Please have a try with the master branch version just to be sure it does not come from something else.
Hi @MacKentoch, i tried to install from branch master, but I got an error like this
How to fixed it? Thanks
+1