react-native-kontaktio
                                
                                 react-native-kontaktio copied to clipboard
                                
                                    react-native-kontaktio copied to clipboard
                            
                            
                            
                        Not working on Android 10 [Solved]
I tried to implement the minimal code on Android 10 device. I seems that the device is not able to add listeners as the DeviceEventEmitter.addlistener() is not working.
if(isAndroid) {
      console.log('enter listener')
      DeviceEventEmitter.addListener('beaconsDidUpdate', ({beacons, region}) => {
        console.log('checking places')
        for (i = 0; i < beacons.length; i++) {
          console.log('Beacons detected [major, rssi, uuid]---->', beacons[i].major, beacons[i].rssi, beacons[i].uuid);
      }});
  } 
else {
      kontaktEmitter.addListener('didRangeBeacons', ({beacons, region}) => {
        console.log('BeaconsinRange: ', beacons.length);
        for (i = 0; i < beacons.length; i++) {
          console.log('Beacons detected [major, rssi, uuid]---->', beacons[i].major, beacons[i].rssi, beacons[i].uuid);
        }
      });
  }
};
Is there any set up that needs to be done I am missing on? Thanks
Facing same issue, any solution to this
+1 - doesn't work on Android 10 or 11...
Hello guys, As Android 10 has introduced the new requirement of permission, please request "ACCESS_FINE_LOCATION" instead of the "ACCESS_COARSE_LOCATION" in your code. I just made this change and it works on Android 10 and 11 devices again.
don't forget to add <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> into ApplicationManifest.xml file
Ref: https://altbeacon.github.io/android-beacon-library/requesting_permission.html
I already have ACCESS_FINE_LOCATION (and ACCESS_COARSE_LOCATION) in there, and it still doesn't work for Android 10/11. Do you think removing ACCESS_COARSE_LOCATION would help? Does yours have that too?
In the latest Minimal Example(maybe updated since last year), I have replaced the "PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION" with "PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION", and it starts to work on Android 10 and 11 devices.
By the way, do you have <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> in your ApplicationManifest.xml file?
Yeah, that's already in there. I'll try removing ACCESS_COARSE_LOCATION perhaps, and see if it helps.
Thanks @hl2000 for sharing this! Would you mind updating the Android docs and the Minimal Example to reflect this new requirement for Android 10+?