Estimote / Android-Proximity-SDK

Estimote Proximity SDK for Android
https://developer.estimote.com
MIT License
82 stars 42 forks source link

ScannerFactory - estimoteLocationScan() problem with Android 7.0 and Huawei P9 Lite #81

Open cobainmo opened 5 years ago

cobainmo commented 5 years ago

Prerequisites

Basic information

Estimote SDK version: proximity-sdk:1.0.3

Android devices affected: Huawei P9 Lite, Motorola Z play

Android OS version affected: Android 7.0

Beacon hardware version: J1.6.

Description

I am testing ScannerFactory on over 30 devices. It works great on all of them except some 7.0 devices like Motorola Z play (problem is solved afrer updating to 8.0) and on Huawei P9 Lite (There is no OTA update from 7.0) This is code sample:

scanHandler = scannerFactory.estimoteLocationScan().withLowPowerMode().withOnPacketFoundAction(new Function1<EstimoteLocation, Unit>() {
            @Override
            public Unit invoke(EstimoteLocation estimoteLocation) {
                Log.i("ESTIMOTE LOCATION","SCAN: "+ estimoteLocation.getDeviceId()+" VALUE: "+estimoteLocation.getRssi() );
                return null;
            }
        }).withOnScanErrorAction(new Function1<Throwable, Unit>() {
            @Override
            public Unit invoke(Throwable throwable) {
                throwable.getStackTrace();

                return null;
            }
        }).start();

It detects beacon and then period from other detection can be from one minute to over an hour or two. Meanwhile i have background service that is checking if there is any beacon detected every 5 seconds. That part works fine, just EstimoteBluetoothScannerFactory.LocationScan does not detect anything.

Also worth mentioning is that i tried to initialise EstimoteBluetoothScannerFactory and start scanning again if nothing is detected for 3 minutes, but that does not help too.

(Optional) Steps to reproduce:

  1. Just let it work

Expected behavior: It should detect beacons in under minute

Actual behavior: It does not detect beacons somethimes for over 1 hour

renno-bih commented 5 years ago

Similar problem with Samsung Galaxy S6 SM-G920F Android 7.0 and LG G5 Android vers 7.0.

pawelDylag commented 5 years ago

Hey @cobainmo

Sorry for the delay! It seems that the BLE implementation on those phones is behaving differently. Also, it may be a problem with sole Android 7.0. I will add this to my backlog and will keep you updated on progress.

Cheers! Paweł

cobainmo commented 5 years ago

Hey @pawelDylag , Thank you.

I solved issue on P9 Lite by turning off and on bluetooth after predefined period if dont find anything.

Now this problem appears on 8+ versions on some models: Huawei Mate 10 lite, Huawei P10 Lite, Huawei P20 Lite, Samsung Galaxy A7 (2018 is not working at all. Can't scan any). This could be due software inside phone like battery optimisation and similar.

I have 82 different devices and android versions running app with estimote. If i can help you debugging, let me know.