evothings / phonegap-estimotebeacons

This repository is no longer maintained - new maintainer is welcome!
MIT License
338 stars 178 forks source link

This cannot be run on UI thread, starting BLE scan can be expensive #92

Open bsorrentino opened 9 years ago

bsorrentino commented 9 years ago

Hi i've ran a Cordova App using this plugin on a device with Android 5.0.2 and got the error below

I've seen that on Estimote/Android-SDK such issue seems resolved but how can I solve it using the phonegap plugin ?

08-25 23:14:25.441    9187-9187/org.bsc.beacon E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: org.bsc.beacon, PID: 9187
    java.lang.IllegalArgumentException: This cannot be run on UI thread, starting BLE scan can be expensive
            at com.estimote.sdk.internal.Preconditions.checkArgument(Preconditions.java:65)
            at com.estimote.sdk.service.BeaconService.checkNotOnUiThread(BeaconService.java:529)
            at com.estimote.sdk.service.BeaconService.access$600(BeaconService.java:62)
            at com.estimote.sdk.service.BeaconService$InternalLeScanCallback.onLeScan(BeaconService.java:517)
            at android.bluetooth.BluetoothAdapter$2.onScanResult(BluetoothAdapter.java:1720)
            at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper$1.run(BluetoothLeScanner.java:330)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5312)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
digiclick74 commented 9 years ago

I have the same problem on an Asus Zenfone 2 with Lollipop 5.0 version. Any news?