Библиотека маячков Android Altbeacon не работает после того, как устройство отключило экран в течение значительного времени

Версия библиотеки Android Beacon: 2.16.2

Проблемы с устройствами возникают на: Samsung 8.1, Samsung 8.0, Samsung 7.1.1

У меня возникают проблемы, когда библиотека Altbeacon не обнаруживает маяки в течение 30, 40, 50, вплоть до 1000 секунд. Кажется, это происходит только при выключенном экране.

Android-манифест

    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Вот мое создание beaconManager, он находится внутри постоянно включенной службы переднего плана.

private fun createBeaconMgr() {
        BeaconManager.setDebug(true)
        beaconManager = BeaconManager.getInstanceForApplication(this)

        if (!beaconManager.scheduledScanJobsEnabled)
        {
            beaconManager.setEnableScheduledScanJobs(true)

        }
        beaconManager.beaconParsers.apply {
            add(BeaconParser().setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT))
            add(BeaconParser().setBeaconLayout(BeaconParser.EDDYSTONE_URL_LAYOUT))
            add(BeaconParser().setBeaconLayout(BeaconParser.EDDYSTONE_TLM_LAYOUT))
        }



        beaconManager.bind(this)

    }

Это мой beaconServiceConnect и другие переопределения.

    override fun onBeaconServiceConnect() {
        if (beaconManager.rangingNotifiers.isNotEmpty() && beaconManager.monitoringNotifiers.isNotEmpty()) {
            return
        }

        //TODO: Dynamically build identifiers and regions

        beaconManager.foregroundScanPeriod = 1100
        beaconManager.foregroundBetweenScanPeriod = 0

        beaconManager.updateScanPeriods()

        try {
            //Start looking for Beacons
            beaconManager.startMonitoringBeaconsInRegion(beacon1Region)
            beaconManager.startMonitoringBeaconsInRegion(beacon2Region)
            beaconManager.startMonitoringBeaconsInRegion(beacon3Region)
            //Start range finding beacons
            beaconManager.startRangingBeaconsInRegion(beacon1Region)
            beaconManager.startRangingBeaconsInRegion(beacon2Region)
            beaconManager.startRangingBeaconsInRegion(beacon3Region)
        } catch (e: Exception) {
            Log.e(TAG, e.message!!)
        }

        beaconManager.addRangeNotifier(this)
        beaconManager.addMonitorNotifier(this)
    }

    override fun didEnterRegion(region: Region) {
        //possibly temporarily added. Issues occured before this, and this was a solution we tried
        beaconManager.startRangingBeaconsInRegion(beacon1Region)
        beaconManager.startRangingBeaconsInRegion(beacon2Region)
        beaconManager.startRangingBeaconsInRegion(beacon3Region)
    }

    override fun didExitRegion(region: Region) {
        Log.d(TAG, "Did exit")
    }

    override fun didDetermineStateForRegion(state: Int, region: Region) {
        Log.d(TAG, "did determine")
    }

    override fun didRangeBeaconsInRegion(beacons: Collection<Beacon>, region: Region) {

        val dateRead = Date() //this is logged to our database

        //business logic below
}

Ниже приведен логарифм за определенное время, когда он не обнаружил маяк, хотя я оставил один на верхней части планшета (он не обнаруживал его в течение ~ 26 секунд). По запросу я могу предоставить дополнительные журналы.

Processing pdu type FF: 0201060208001107757ed3e418284a0c8362c229c3a6da7207ff88c6267c6901000000000000000000000000000000000000000000000000000000000000 with startIndex: 26, endIndex: 31

[ 09-17 15:15:10.924  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.925  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:10.925  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:10.925  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.925  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.926  2943: 4306 D/BtGatt.ContextMap ]
sendClientScanResult for app id 6

[ 09-17 15:15:10.928 24172:24461 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.928 24172:24461 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.923 24172: 3828 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:10.929 24172:24172 D/CycledLeScannerForLollipop ]
got record

[ 09-17 15:15:10.943  2565: 3188 D/libgps   ]
OnGpsExtensionMessage: message_id(1), data(0x7b0b2038), size(3336)


[ 09-17 15:15:10.944  2565: 3188 D/libgps   ]
proxy__gnss_sv_status_cb: called. num_svs(2)

[ 09-17 15:15:10.944  2565: 3188 D/GnssLocationProvider_ex ]
SV Count : 2(0) / TOP5(v) : 27 17  / TOP5(u) : 

[ 09-17 15:15:10.957  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.958  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.958  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:10.958  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:10.958  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.958  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.958  2943: 4306 D/BtGatt.ContextMap ]
sendClientScanResult for app id 6

[ 09-17 15:15:10.959 24172:24185 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.959 24172:24185 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.959 24172:24172 D/CycledLeScannerForLollipop ]
got record

[ 09-17 15:15:10.968  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.968  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.969  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:10.969  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:10.969  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.969  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.971  2943: 4306 D/BtGatt.ContextMap ]
sendClientScanResult for app id 6

[ 09-17 15:15:10.972 24172:24184 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.972 24172:24184 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.972 24172:24172 D/CycledLeScannerForLollipop ]
got record

[ 09-17 15:15:10.989  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.989  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.989  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:10.989  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:10.989  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.989  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.990  2943: 4306 D/BtGatt.ContextMap ]
sendClientScanResult for app id 6

[ 09-17 15:15:10.991 24172:24461 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:10.991 24172:24461 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:10.991 24172:24172 D/CycledLeScannerForLollipop ]
got record

[ 09-17 15:15:10.992 24172: 3830 D/BeaconParser ]
Processing pdu type FF: 1eff060001092002d94a4a4a79d87c0805372dedc5569f4b9b9bdd4f4fcbdf00000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 30

[ 09-17 15:15:10.992 24172: 3830 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 2 and 10 at offset 4.  The bytes I see are: 1eff060001092002d94a4a4a79d87c0805372dedc5569f4b9b9bdd4f4fcbdf00000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:10.992 24172: 3830 D/BeaconParser ]
Processing pdu type FF: 1eff060001092002d94a4a4a79d87c0805372dedc5569f4b9b9bdd4f4fcbdf00000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 30

[ 09-17 15:15:10.992 24172: 3830 D/BeaconParser ]
This is not a matching Beacon advertisement. (Was expecting be ac.  The bytes I see are: 1eff060001092002d94a4a4a79d87c0805372dedc5569f4b9b9bdd4f4fcbdf00000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.019  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.019  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.019  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.019  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.019  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.019  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.025  2943: 4306 D/BtGatt.ContextMap ]
sendClientScanResult for app id 6

[ 09-17 15:15:11.029  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.029  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.029  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.029  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.029  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.029  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.030 24172:24172 D/CycledLeScanner ]
Waiting to stop scan cycle for another 100 milliseconds

[ 09-17 15:15:11.035  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.035  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.036  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.036  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.036  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.036  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.044 24172: 3826 D/BeaconParser ]
Processing pdu type FF: 1bff75004204018060c048e6fa643dc248e6fa643c016f000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 27

[ 09-17 15:15:11.045 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 26 and 10 at offset 28.  The bytes I see are: 0201060208001107757ed3e418284a0c8362c229c3a6da7207ff88c6267c6901000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.046 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.046 24172: 3827 D/BeaconParser ]
Ignoring pdu type 08

[ 09-17 15:15:11.046 24172: 3827 D/BeaconParser ]
Ignoring pdu type 07

[ 09-17 15:15:11.046 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 0201060208001107757ed3e418284a0c8362c229c3a6da7207ff88c6267c6901000000000000000000000000000000000000000000000000000000000000 with startIndex: 26, endIndex: 31

[ 09-17 15:15:11.046 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. (Was expecting be ac.  The bytes I see are: 0201060208001107757ed3e418284a0c8362c229c3a6da7207ff88c6267c6901000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.046 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.046 24172: 3827 D/BeaconParser ]
Ignoring pdu type 08

[ 09-17 15:15:11.046 24172: 3827 D/BeaconParser ]
Ignoring pdu type 07

[ 09-17 15:15:11.047 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 0201060208001107757ed3e418284a0c8362c229c3a6da7207ff88c6267c6901000000000000000000000000000000000000000000000000000000000000 with startIndex: 26, endIndex: 31

[ 09-17 15:15:11.047 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 26 and 00 at offset 28.  The bytes I see are: 0201060208001107757ed3e418284a0c8362c229c3a6da7207ff88c6267c6901000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.047 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.047 24172: 3827 D/BeaconParser ]
Ignoring pdu type 08

[ 09-17 15:15:11.047 24172: 3827 D/BeaconParser ]
Ignoring pdu type 07

[ 09-17 15:15:11.047 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 0201060208001107757ed3e418284a0c8362c229c3a6da7207ff88c6267c6901000000000000000000000000000000000000000000000000000000000000 with startIndex: 26, endIndex: 31

[ 09-17 15:15:11.048 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 26 and 20 at offset 28.  The bytes I see are: 0201060208001107757ed3e418284a0c8362c229c3a6da7207ff88c6267c6901000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.048 24172: 3829 D/BeaconParser ]
This is not a matching Beacon advertisement. (Was expecting be ac.  The bytes I see are: 02011a1aff4c000c0e007082d2b06a4412c1d208efdf4a10050b1c24d3bd0000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.048 24172: 3829 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.048 24172: 3829 D/BeaconParser ]
Processing pdu type FF: 02011a1aff4c000c0e007082d2b06a4412c1d208efdf4a10050b1c24d3bd0000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 29

[ 09-17 15:15:11.049 24172: 3829 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 5 and 00 at offset 7.  The bytes I see are: 02011a1aff4c000c0e007082d2b06a4412c1d208efdf4a10050b1c24d3bd0000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.049 24172: 3829 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.049 24172: 3829 D/BeaconParser ]
Processing pdu type FF: 02011a1aff4c000c0e007082d2b06a4412c1d208efdf4a10050b1c24d3bd0000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 29

[ 09-17 15:15:11.049 24172: 3829 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 5 and 20 at offset 7.  The bytes I see are: 02011a1aff4c000c0e007082d2b06a4412c1d208efdf4a10050b1c24d3bd0000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.056  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.057  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.057  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.057  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.057  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.057  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.061  2943: 4306 D/BtGatt.ContextMap ]
sendClientScanResult for app id 6

[ 09-17 15:15:11.061  2943: 4306 D/BtGatt.ContextMap ]
sendClientScanResult for app id 6

[ 09-17 15:15:11.061  2943: 4306 D/BtGatt.ContextMap ]
sendClientScanResult for app id 6

[ 09-17 15:15:11.062 24172:24185 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.062 24172:24185 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.063 24172: 3830 D/BeaconParser ]
Processing pdu type FF: 1eff060001092002d94a4a4a79d87c0805372dedc5569f4b9b9bdd4f4fcbdf00000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 30

[ 09-17 15:15:11.063  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.063  2565:24988 D/LocationManagerService ]
getProviders()=[gps]

[ 09-17 15:15:11.063  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.063  2565:24988 D/LocationManagerService ]
getBestProvider(Criteria[power=NO_REQ acc=HIGH], true)=gps

[ 09-17 15:15:11.063  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.063  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.063  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.063  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.063 24172: 3830 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 2 and 00 at offset 4.  The bytes I see are: 1eff060001092002d94a4a4a79d87c0805372dedc5569f4b9b9bdd4f4fcbdf00000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.064  2943: 4306 D/BtGatt.ContextMap ]
sendClientScanResult for app id 6

[ 09-17 15:15:11.065 20589:20612 D/DriverLocationManager ]
getBestProvider: gps

[ 09-17 15:15:11.066  2565: 3565 D/LocationManagerService ]
getLastLocation: Request[ACCURACY_FINE gps requested=0 fastest=0 num=1]

[ 09-17 15:15:11.045 24172: 3828 D/BeaconParser ]
Processing pdu type FF: 0201060aff4c0010050b1cf8e6ef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13

[ 09-17 15:15:11.066 24172: 3830 D/BeaconParser ]
Processing pdu type FF: 1eff060001092002d94a4a4a79d87c0805372dedc5569f4b9b9bdd4f4fcbdf00000000000000000000000000000000000000000000000000000000000000 with startIndex: 2, endIndex: 30

[ 09-17 15:15:11.067 24172: 3830 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 2 and 20 at offset 4.  The bytes I see are: 1eff060001092002d94a4a4a79d87c0805372dedc5569f4b9b9bdd4f4fcbdf00000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.067 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.067 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 02011b0bff4c00090603000a010ae10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 14

[ 09-17 15:15:11.067 24172: 3830 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.067 24172:24185 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.067 24172:24185 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.067 24172: 3830 D/BeaconParser ]
Processing pdu type FF: 02011a0aff4c001005131c09b535000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13

[ 09-17 15:15:11.067 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 5 and 10 at offset 7.  The bytes I see are: 02011b0bff4c00090603000a010ae10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.067 20589:20612 I/com.changedName.android.obuservices.ScreenBlockService ]
Speed:0

[ 09-17 15:15:11.067 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.067 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 02011b0bff4c00090603000a010ae10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 14

[ 09-17 15:15:11.067 20589:20612 I/com.changedName.android.obuservices.ScreenBlockService ]
check driving status: false0

[ 09-17 15:15:11.068 24172: 3830 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 5 and 10 at offset 7.  The bytes I see are: 02011a0aff4c001005131c09b535000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.068 24172: 3830 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.068 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. (Was expecting be ac.  The bytes I see are: 02011b0bff4c00090603000a010ae10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.068 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.068 24172: 3830 D/BeaconParser ]
Processing pdu type FF: 02011a0aff4c001005131c09b535000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13

[ 09-17 15:15:11.068 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 02011b0bff4c00090603000a010ae10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 14

[ 09-17 15:15:11.068 24172: 3830 D/BeaconParser ]
This is not a matching Beacon advertisement. (Was expecting be ac.  The bytes I see are: 02011a0aff4c001005131c09b535000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.068 24172: 3830 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.068 24172:24172 D/CycledLeScannerForLollipop ]
got record

[ 09-17 15:15:11.068 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 5 and 00 at offset 7.  The bytes I see are: 02011b0bff4c00090603000a010ae10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.068 24172: 3830 D/BeaconParser ]
Processing pdu type FF: 02011a0aff4c001005131c09b535000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13

[ 09-17 15:15:11.069 24172:24172 D/CycledLeScannerForLollipop ]
got record

[ 09-17 15:15:11.069 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.069 24172:24185 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.069 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 02011b0bff4c00090603000a010ae10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 14

[ 09-17 15:15:11.069 24172:24185 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.069 24172: 3830 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 5 and 00 at offset 7.  The bytes I see are: 02011a0aff4c001005131c09b535000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.069 24172: 3830 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.069 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 5 and 20 at offset 7.  The bytes I see are: 02011b0bff4c00090603000a010ae10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.069 24172:24185 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.069 24172:24185 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.069 24172: 3830 D/BeaconParser ]
Processing pdu type FF: 02011a0aff4c001005131c09b535000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13

[ 09-17 15:15:11.069 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.070 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 02011a0aff4c0010051a1cbc5298000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13

[ 09-17 15:15:11.070 24172:24185 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.070 24172: 3830 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 5 and 20 at offset 7.  The bytes I see are: 02011a0aff4c001005131c09b535000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.070 24172:24185 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.070 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. Was expecting aa fe at offset 5 and 10 at offset 7.  The bytes I see are: 02011a0aff4c0010051a1cbc5298000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.070 24172: 3830 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.070 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.070 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 02011a0aff4c0010051a1cbc5298000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13

[ 09-17 15:15:11.071 24172:24172 D/CycledLeScannerForLollipop ]
got record

[ 09-17 15:15:11.071 24172:24172 D/CycledLeScannerForLollipop ]
got record

[ 09-17 15:15:11.071 24172: 3827 D/BeaconParser ]
This is not a matching Beacon advertisement. (Was expecting be ac.  The bytes I see are: 02011a0aff4c0010051a1cbc5298000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

[ 09-17 15:15:11.071 24172:24172 D/CycledLeScannerForLollipop ]
with service uuid: 00001122-0000-1000-8000-00805f9b34fb

[ 09-17 15:15:11.071 24172: 3827 D/BeaconParser ]
Ignoring pdu type 01

[ 09-17 15:15:11.071 24172:24172 D/CycledLeScannerForLollipop ]
got record

[ 09-17 15:15:11.071  2943: 3063 D/ScanRecord ]
parseFromBytes

[ 09-17 15:15:11.071  2943: 3063 D/ScanRecord ]
first manudata for manu ID

[ 09-17 15:15:11.071 24172: 3830 D/BeaconParser ]
Processing pdu type FF: 02011a1aff4c000c0e007082d2b06a4412c1d208efdf4a10050b1c24d3bd0000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 29

[ 09-17 15:15:11.071  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.071 24172: 3827 D/BeaconParser ]
Processing pdu type FF: 02011a0aff4c0010051a1cbc5298000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 13

[ 09-17 15:15:11.071  2943: 3063 D/ScanRecord ]
Not a Multi Manu data

[ 09-17 15:15:11.071  2943: 3063 D/ScanRecord ]
parseFromBytes

Любые идеи?

Set up a scan filter: BluetoothLeScanFilter [mDeviceName=null, mDeviceAddress=null, mUuid=null, mUuidMask=null, mServiceDataUuid=null, mServiceData=null, mServiceDataMask=null, mManufacturerId=118, mManufacturerData=BE AC, mManufacturerDataMask=FF FF]

[ 09-17 17:34:43.831  7169: 7392 D/ScanFilterUtils ]
making scan filter for service: 0000FEAA-0000-1000-8000-00805f9b34fb 0000feaa-0000-1000-8000-00805f9b34fb

[ 09-17 17:34:43.831  7169: 7392 D/ScanFilterUtils ]
making scan filter with service mask: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF ffffffff-ffff-ffff-ffff-ffffffffffff

[ 09-17 17:34:43.831  7169: 7392 D/ScanFilterUtils ]
Set up a scan filter: BluetoothLeScanFilter [mDeviceName=null, mDeviceAddress=null, mUuid=0000feaa-0000-1000-8000-00805f9b34fb, mUuidMask=ffffffff-ffff-ffff-ffff-ffffffffffff, mServiceDataUuid=null, mServiceData=null, mServiceDataMask=null, mManufacturerId=ffffffff, mManufacturerData=null, mManufacturerDataMask=null]

[ 09-17 17:34:43.832  7169: 7392 D/ScanFilterUtils ]
making scan filter for service: 0000FEAA-0000-1000-8000-00805f9b34fb 0000feaa-0000-1000-8000-00805f9b34fb

[ 09-17 17:34:43.832  7169: 7392 D/ScanFilterUtils ]
making scan filter with service mask: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF ffffffff-ffff-ffff-ffff-ffffffffffff

[ 09-17 17:34:43.832  7169: 7392 D/ScanFilterUtils ]
Set up a scan filter: BluetoothLeScanFilter [mDeviceName=null, mDeviceAddress=null, mUuid=0000feaa-0000-1000-8000-00805f9b34fb, mUuidMask=ffffffff-ffff-ffff-ffff-ffffffffffff, mServiceDataUuid=null, mServiceData=null, mServiceDataMask=null, mManufacturerId=ffffffff, mManufacturerData=null, mManufacturerDataMask=null]

[ 09-17 17:34:43.833  7169: 7392 D/ScanFilterUtils ]
making scan filter for service: 0000FEAA-0000-1000-8000-00805f9b34fb 0000feaa-0000-1000-8000-00805f9b34fb

[ 09-17 17:34:43.833  7169: 7392 D/ScanFilterUtils ]
making scan filter with service mask: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF ffffffff-ffff-ffff-ffff-ffffffffffff

[ 09-17 17:34:43.833  7169: 7392 D/ScanFilterUtils ]
Set up a scan filter: BluetoothLeScanFilter [mDeviceName=null, mDeviceAddress=null, mUuid=0000feaa-0000-1000-8000-00805f9b34fb, mUuidMask=ffffffff-ffff-ffff-ffff-ffffffffffff, mServiceDataUuid=null, mServiceData=null, mServiceDataMask=null, mManufacturerId=ffffffff, mManufacturerData=null, mManufacturerDataMask=null]

person atotalnoob    schedule 17.09.2019    source источник
comment
Я подозреваю, что проблема связана с несоответствующим фильтром сканирования. После перевода приложения в фоновый режим поищите строки журнала, подобные приведенным ниже. и добавьте их в свой вопрос или в комментарий здесь. (Вы должны увидеть 3-4 разные строки журнала, подобные этой, поскольку вы добавляете три анализатора маяка). D/ScanFilterUtils: Set up a scan filter: BluetoothLeScanFilter [mDeviceName=null, mDeviceAddress=null, mUuid=0000fe6a-0000-1000-8000-00805f9b34fb, mUuidMask=ffffffff-ffff-ffff-ffff-ffffffffffff, mServiceDataUuid=null, mServiceData=null, mServiceDataMask=null, mManufacturerId=ffffffff `   -  person davidgyoung    schedule 18.09.2019
comment
Привет, Дэвид, обновил сообщение запрошенными данными. Это происходит в нашем офисе, у меня всегда в радиусе действия два маяка, почему бы ему не обнаружить их? Вокруг нашего офиса могут быть другие устройства, транслирующие вещание, но он всегда должен обнаруживать 2. Он обнаруживает их, когда экран включен, почему выключение экрана имеет значение?   -  person atotalnoob    schedule 18.09.2019


Ответы (3)


Когда экран выключен, устройства Samsung с Android 8.1+ требуют, чтобы использовались непустые фильтры сканирования BLE, иначе нельзя будет обнаружить пакеты BLE. Библиотека Android Beacon знает об этом, поэтому она настраивает фильтры сканирования для каждого активного BeaconParser, чтобы

По какой-то причине эти фильтры ScanFilters, показанные в вашем вопросе, похоже, не соответствуют ожидаемым вами пакетам, несмотря на то, что они хорошо выглядят. Почему? Один из возможных ответов заключается в том, что на вашем устройстве закончились фильтры ScanFilters - для каждого из них требуется слот на микросхеме Bluetooth, а количество разъемов ограничено для всех приложений на вашем телефоне. Вот несколько вещей, которые вы можете попробовать проверить, если это так:

  1. Очистите анализатор маяка по умолчанию (для AltBeacon), поскольку вы не используете его с BeaconParser().clear()
  2. Попробуйте добавить только ОДИН анализатор маяка (вместо трех показанных) и проверьте, обнаруживается ли только этот тип маяка с выключенным экраном.
  3. Если пункты (1) и (2) не помогли, перезагрузите телефон и повторите попытку. Это может очистить зависшие парсеры маяков.
  4. Если ничего из вышеперечисленного не помогло, попробуйте удалить другие приложения, которые, по вашему мнению, могут выполнять сканирование маяков Bluetooth, и закрепить ограниченное количество слотов ScanFilter на чипе Bluetooth, затем перезагрузите компьютер и повторите попытку.
person davidgyoung    schedule 18.09.2019
comment
Итак, я тестирую вышесказанное. Дело не в том, что он никогда не работает с выключенным экраном, а в том, что он не работает через ~ 1 час. График времени между каждым обнаружением в секундах. imgur.com/a/gOthiyw После установки новой версии переведите приложение в фоновый режим и отставьте планшет в сторону с выключенным экраном. Все планшеты очищены на заводе-изготовителе, поэтому только стандартные приложения Samsung устанавливаются. У меня также есть весь журнал с прошлой ночи (текстовый файл 1,8 ГБ), которым я могу поделиться ... - person atotalnoob; 18.09.2019

Начиная с Android N, сканирование продолжительностью 30 минут и более блокируется в фоновом режиме. Вы можете принудительно найти обходной путь при использовании Android Beacon Library, добавив это в AndroidManifest.xml:

<service android:name="org.altbeacon.beacon.service.BeaconService"
             tools:node="replace">
        <meta-data android:name="longScanForcingEnabled" android:value="true"/>
</service>
person davidgyoung    schedule 19.09.2019
comment
Это у меня уже есть. Пожалуйста, проверьте мой ответ, с библиотекой проблем не было - person atotalnoob; 19.09.2019

Оказывается, из-за моего двухстороннего метода аутентификации некоторые журналы не попадали в API, но журналы не отображались, потому что они находятся на уровне TLS.

При запросе к БД на устройстве было обнаружено 3,5 миллиона журналов, поэтому проблем с библиотекой маяков Android не было.

person atotalnoob    schedule 19.09.2019
comment
Рад, что ты нашел проблему - person davidgyoung; 19.09.2019
comment
Спасибо за вашу помощь! Высоко оценен! Если ты в Сан-Франциско, я куплю тебе пива. - person atotalnoob; 19.09.2019