MacKentoch / react-native-beacons-manager

React-Native library for detecting beacons (iOS and Android)
MIT License
579 stars 319 forks source link

startRanging, error: java.lang.NullPointerException: uniqueId may not be null #131

Open rosemarystanley opened 5 years ago

rosemarystanley commented 5 years ago

Version

1.0.7

Platform

Android

OS version

android 6.0.1

Steps to reproduce

  1. Install react-native-beacons-manager as outlined.
  2. componentWillMount () {
    const region = {
    identifier: "myidentifier",
    uuid: "xxx-xxx-xxx-xxx-xxx"
    }
    
    Beacons.detectEstimotes() // also tried Beacons.detectIBeacons()
    Beacons.startMonitoringForRegion(region) // also tried 
    Beacons.startMonitoringForRegion(region.identifier, region.uuid)
    Beacons.startRangingBeaconsInRegion(region) // also tried Beacons.startRangingBeaconsInRegion(region.identifier, region.uuid)
    }
  3. Run app in studio debugger (while connected to actual device Galaxy S5) i also tried running using react-native run-android. Same issues. I also did verify I had Location and Bluetooth permissions and turned on in the device.

Expected behavior

Beacons start ranging and getting results.

Actual behavior

App doesn't crash but nothing happens and this error is in the debug console.

D/BeaconParser: Parsing beacon layout: m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24
D/BeaconsAndroidModule: startRanging, rangingRegionId: null, rangingBeaconUuid: null
E/BeaconsAndroidModule: startRanging, error: 
    java.lang.NullPointerException: uniqueId may not be null
        at org.altbeacon.beacon.Region.<init>(Region.java:87)
        at com.mackentoch.beaconsandroid.BeaconsAndroidModule.createRegion(BeaconsAndroidModule.java:339)
        at com.mackentoch.beaconsandroid.BeaconsAndroidModule.startRanging(BeaconsAndroidModule.java:266)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:158)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
        at java.lang.Thread.run(Thread.java:818)
sourabhmisal commented 5 years ago

Temporary solution :

npm i MacKentoch/react-native-beacons-manager

Hope it helps..