Android-Proximity-SDK icon indicating copy to clipboard operation
Android-Proximity-SDK copied to clipboard

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

Open cobainmo opened this issue 7 years ago • 3 comments

Prerequisites

  • [x] Put an X between the brackets on this line if you have done all of the following:
    • My beacons have Estimote Monitoring enabled (Check it in the Estimote Cloud, or via app)
    • My Android device/devices supports BLE and has Android OS version >= 5.0.0
    • My Android device/devices have bluetooth enabled
    • My app has Location Permissions granted

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

cobainmo avatar Oct 30 '18 08:10 cobainmo

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

renno-bih avatar Nov 15 '18 12:11 renno-bih

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ł

pawelDylag avatar Dec 13 '18 10:12 pawelDylag

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.

cobainmo avatar Dec 13 '18 11:12 cobainmo