Estimote / Android-Fleet-Management-SDK

Estimote Fleet Management SDK for Android
https://developer.estimote.com
MIT License
836 stars 451 forks source link

Unable to start BLE scanning. Error code: 4 #261

Closed kitor closed 6 years ago

kitor commented 6 years ago

On one of my devices, (LeTV x500, running Resurrection OS / Android 7.1.2) I have problem with getting Estimote Beacons to work. Estimote app can't see any beacon in range. My app receives following error: E/EstimoteSDK: LollipopBluetoothAdapter$1.onScanFailed:244 Unable to start BLE scanning. Error code: 4

Other apps using iBeacon directly (eg Beacon Scanner) shows all three beacons (one Location and two original hw version D) without problems.

Code is almost copy-pasted from example:

   beaconManager.setRangingListener(new BeaconManager.BeaconRangingListener() {
        @Override
        public void onBeaconsDiscovered(BeaconRegion beaconRegion, List<Beacon> beacons) {
            Log.d("LocationListener", "Nearby beacons: " + beacons);
        //do some things
        }
    });;

    beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady() {
            //beaconManager.startMonitoring(region);
            beaconManager.startRanging(region);
        }
    });

I'm using latest SDK, on different phone with same Resurrection OS / Android 7.1.2 (Xiaomi Mi Max) it works OK.

pawelDylag commented 6 years ago

Hey! I just wanted you to know that we are in the process of moving our SDK for Android to a completely new architecture. We won't be publishing any updates to our old (current master) SDK for a while.

But don't worry - there is an ALPHA version of our FRESH PROXIMITY SDK available now! It uses a completely new scanning mechanism and will work on new Android versions like a charm (6.0, 7.0, 8.0). We did a great job with renovating our ecosystem to cut off the old, messy code, full of hacks for Android KitKat an Jellybean. This is why working with BeaconManager was so frustrating by the way.

Plan for the next couple of weeks:

  1. ProximitySDK beta release - our own tag-based proximity. Use it to achieve the same behaviour as using iBeacon (monitoring/ranging). It is uses our own packets called Estimote Location and is backed-up by our own data-science. Read more here -> http://blog.estimote.com/post/166007374930/the-most-reliable-proximity-tech-now-with-a
  2. ScanningSDK beta release - a separate core library dedicated for raw scanning - it will handle the scanning on all android versions for you, battery efficiency, background/foreground, and will deliver raw stream of packet data (Such as iBeacon, Eddystone, EstimoteLocation, EstimoteTelemetry, etc).

I encourage you to try it out - there is a ready made app for you to show the possibilities of our completely new SDK -> https://github.com/Estimote/Android-SDK/tree/proximity-sdk Let us know what you think! I will keep you updated about the progress.

kitor commented 6 years ago

Requirements One or more Estimote Proximity or Location Beacon with the Estimote Location packet advertising enabled.

We won't be publishing any updates to our old (current master) SDK for a while.

We own first generation (hw version D) beacons, so how this will fix our issue? Yay, best customer support ever! And what's funny for me, it's easy to emulate Proximity beacons using old sdk Ranging, so you're just dropping hw support because you can.

pawelDylag commented 6 years ago

Hey @kitor!

Old D3.4 beacons are broadcasting iBeacon packets only. You will still be able to scan your beacons using our new ScanningSDK. Unfortunately you won't be able to use our Proximity features - this requires your beacons to broadcast Estimote Location packet.

If you need the scanning behaviour like ranging - as you posted in your snippet - then don't worry. This will be covered by ScanningSDK soon. On the other hand, if you need something like monitoring - well, you need to use our old SDK. But I can tell that eventually we will create iBeacon monitoring in ProximitySDK - but this decision doesn't belong to me, unfortunately.

Cheers!