react-native-beacons-manager
react-native-beacons-manager copied to clipboard
Android : Beacons list is always empty Android in beaconsDidRange
Version
1.0.1
Platform
Android
OS version
android 6.0...
Steps to reproduce
When I am ranging a beacon with region data I am getting an empty list of a beacon in the event handler below DeviceEventEmitter.addListener('beaconsDidRange', data => { console.log('beaconsDidRange beacons!', data); });
Expected behavior
{ region: { identifier: 'iBeacon', uuid: 'XXXXXXX-XXX-XXXXX-XXXX-XXXXXXXXXX' }, beacons: [ { uuid: 'XXXXXXX-XXX-XXXXX-XXXX-XXXXXXXXXX', accuracy: -1, proximity: 'unknown', major: X, rssi: 0, minor: X } ] }
Actual behavior
{ beacons: [], uuid: 'XXXXXXX-XXX-XXXXX-XXXX-XXXXXXXXXX', identifier: 'iBeacon' }
I'm having the same problem
I am also having same problem in android platform.
Any update, facing the same issue.
@flpputsch @SubhashisPK have you solved?
no @umair-khanzada did not able to solve.
Did anyone solve this?
I had to add <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
to the AndroidManifest.xml and of course grant the permission to make it work.
@maevic Not working.
"react-native": "0.60.5",
"react-native-beacons-manager": "^1.0.7"
Sorry, forgot to mention that I also patched the module as per PR #155. This enabled me to use react native version 0.61.2.
@maevic I have changed in my package.json
"react-native-beacons-manager": "github:jitsi/react-native-beacons-manager#d9e8040082570a951f3c8a7a5c96c073821841d6"
and check react-native-beacons-manager > android > build.gradle
it is updated according to #155 PR
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.facebook.react:react-native:+'
Permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
- run cache clean
- and rebuild
but still didn't work, showing empty beacons array []
Did you check in the app details on your android phone that the permissions are actually granted and did you update your react native to version 0.61.2? If I recall correctly I got some problems using 0.60.5.
updated react-native: 0.61.2
but still didn't work for me
It was due to permission looks like even if you ask for permissions in the manifest, Android might not grant them. Apparently the way you solve this is by using react-native's PermissionsAndroid and asking in app to get ACCESS_FINE_LOCATION
location-enabled
thanks, @maevic
Still empty even ACCESS_FINE_LOCATION permission is granted
Sorry, I only used it in Android so far.
I was able to solve the problem with this.
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>