An exception thrown by SDK 0.9.4

Hi there…
I noticed below exception thrown by the SDK. Would appreciate if you can shade some light on it.

Fatal Exception: java.lang.NullPointerException
       at com.estimote.sdk.service.internal.JellyBeanBluetoothAdapter.start(JellyBeanBluetoothAdapter.java:43)
       at com.estimote.sdk.service.internal.CycleBluetoothScanner.start(CycleBluetoothScanner.java:64)
       at com.estimote.sdk.service.BeaconService.startScanning(BeaconService.java:336)
       at com.estimote.sdk.service.BeaconService.startMonitoring(BeaconService.java:286)
       at com.estimote.sdk.service.BeaconService.access$100(BeaconService.java:69)
       at com.estimote.sdk.service.BeaconService$IncomingHandler$1.run(BeaconService.java:440)
       at android.os.Handler.handleCallback(Handler.java:785)
       at android.os.Handler.dispatchMessage(Handler.java:115)
       at android.os.Looper.loop(Looper.java:136)
       at android.os.HandlerThread.run(HandlerThread.java:61)

Thanks

Are you sure you’re on Android 4.3 or later? Earlier versions of Android don’t support Bluetooth Low Energy.

You can use the SystemRequirementsChecker and SystemRequirementsHelper classes to check if the device you’re running the app on supports Bluetooth LE, and also if it meets all the other requirements necessary to be able to scan for beacons.

http://estimote.github.io/Android-SDK/JavaDocs/com/estimote/sdk/SystemRequirementsChecker.html
http://estimote.github.io/Android-SDK/JavaDocs/com/estimote/sdk/SystemRequirementsHelper.html

Yes… I am using a system check to make sure user does not proceed if they don’t have BLE enabled device.

I am using below condition to check the BLE devices.

SystemRequirementsHelper.isBluetoothLeAvailable(this)

However was wondering why the SDK will throw an error even if the device is not supported.

thanks.

I’m not sure I understand, what do you mean?

Sorry for the late response… What I mean is if the device is not capable of BLE, then the SDK should not thrown a Null pointer error, but it should say the BLE is not supported.

Moreover, the Fabric Crashlytics report says, the device is running on 4.4.2 LGE Nexus 5. Which means it has BLE.

Do you know what else it could be?

Thanks again…

Ah, got it. I just checked our SDK and it looks like we fixed this in 0.9.5. Sorry for the trouble!

Well… I update to 0.9.5 and I see a new error now…

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.bluetooth.le.BluetoothLeScanner.startScan(java.util.List, android.bluetooth.le.ScanSettings, android.bluetooth.le.ScanCallback)' on a null object reference
   at com.estimote.sdk.service.internal.LollipopBluetoothAdapter.start(LollipopBluetoothAdapter.java:179)
   at com.estimote.sdk.service.internal.CycleBluetoothScanner.start(CycleBluetoothScanner.java:59)
   at com.estimote.sdk.service.internal.CycleBluetoothScanner$1.run(CycleBluetoothScanner.java:93)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:155)
   at android.os.HandlerThread.run(HandlerThread.java:61)

And this appears only for Lolipop users.

Thanks! Any idea if this crash is with Bluetooth turned off? Do you check in your app if Bluetooth is on before starting beacon discovery?