react-native-beacons-manager icon indicating copy to clipboard operation
react-native-beacons-manager copied to clipboard

Android : Beacons list is always empty Android in beaconsDidRange

Open brajeshsipl opened this issue 5 years ago • 16 comments

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' }

brajeshsipl avatar Aug 08 '19 14:08 brajeshsipl

I'm having the same problem

flpputsch avatar Aug 16 '19 03:08 flpputsch

I am also having same problem in android platform.

SubhashisPK avatar Aug 28 '19 15:08 SubhashisPK

Any update, facing the same issue.

umair-khanzada avatar Sep 21 '19 10:09 umair-khanzada

@flpputsch @SubhashisPK have you solved?

umair-khanzada avatar Sep 21 '19 10:09 umair-khanzada

no @umair-khanzada did not able to solve.

SubhashisPK avatar Sep 23 '19 06:09 SubhashisPK

Did anyone solve this?

ukhanzada-nisum-com avatar Oct 03 '19 15:10 ukhanzada-nisum-com

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 avatar Oct 24 '19 09:10 maevic

@maevic Not working.

"react-native": "0.60.5",
"react-native-beacons-manager": "^1.0.7"

umair-khanzada avatar Oct 31 '19 15:10 umair-khanzada

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 avatar Oct 31 '19 15:10 maevic

@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"/>
  1. run cache clean
  2. and rebuild

but still didn't work, showing empty beacons array []

umair-khanzada avatar Oct 31 '19 21:10 umair-khanzada

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.

maevic avatar Oct 31 '19 21:10 maevic

updated react-native: 0.61.2 but still didn't work for me

umair-khanzada avatar Nov 01 '19 02:11 umair-khanzada

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

umair-khanzada avatar Nov 01 '19 03:11 umair-khanzada

Still empty even ACCESS_FINE_LOCATION permission is granted

ntvinhit avatar Oct 14 '20 08:10 ntvinhit

Sorry, I only used it in Android so far.

maevic avatar Nov 23 '20 14:11 maevic

I was able to solve the problem with this. <uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>

r-kishimoto avatar Jun 04 '21 10:06 r-kishimoto