bluetooth - Alt Beacon Android unstable -
i building android application based on alt beacon. should preface fact test device digiland (p-o-s) tablet running android 4.4.
i using radius networks usb beacon , alt beacon library found here: https://github.com/altbeacon/android-beacon-library
in both own application , in reference application provided library seeing significant instability / extremely slow detection times beacon. example, can see reference application's log below. tablet sitting no more 1/2 meter away beacon whole time.
has seen behavior before? doing wrong? broadcast rate on beacon appears set 10hz , power seems set maximum. should different device , try on that? saw other posts suggested turning off wifi did, , log trial wifi off.
one thing should note have increased scan frequency following block of code in application subclass:
beaconmanager.setbackgroundbetweenscanperiod(9000l); beaconmanager.setbackgroundscanperiod(1000l); beaconmanager.setforegroundbetweenscanperiod(9000l); beaconmanager.setforegroundscanperiod(1000l); try{ beaconmanager.updatescanperiods(); }catch (remoteexception e){ e.printstacktrace(); }
i not sure if done improperly, when remove it, still see same behavior described in log below, on longer period of time.
any advice people have appreciated since feel spinning wheels on this!
07-01 15:23:59.005 10771-10771/org.altbeacon.beaconreference d/referenceapplication﹕ setting background monitoring beacons , power saving 07-01 15:23:59.655 10771-10816/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:23:59.655 10771-10816/org.altbeacon.beaconreference d/referenceapplication﹕ auto launching mainactivity 07-01 15:24:20.154 10771-11297/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:24:39.174 10771-11486/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:25:00.132 10771-11647/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:25:09.472 10771-11730/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:25:30.123 10771-11871/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:25:39.173 10771-11954/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:26:00.065 10771-12070/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:26:29.099 10771-12083/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:26:29.100 10771-12083/org.altbeacon.beaconreference d/referenceapplication﹕ sending notification. 07-01 15:26:40.112 10771-12096/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:27:19.120 10771-12127/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:27:19.120 10771-12127/org.altbeacon.beaconreference d/referenceapplication﹕ sending notification. 07-01 15:27:40.041 10771-12208/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:27:59.110 10771-12786/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:28:30.144 10771-13052/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:28:39.202 10771-13131/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:28:50.133 10771-13226/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:29:09.125 10771-13375/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:29:30.119 10771-13452/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:29:49.144 10771-13473/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:30:00.060 10771-13510/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:30:19.134 10771-13552/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:30:19.135 10771-13552/org.altbeacon.beaconreference d/referenceapplication﹕ sending notification. 07-01 15:30:30.096 10771-13560/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:31:09.124 10771-13575/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:31:09.125 10771-13575/org.altbeacon.beaconreference d/referenceapplication﹕ sending notification. 07-01 15:31:20.110 10771-13576/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:31:29.101 10771-13578/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region. 07-01 15:31:29.101 10771-13578/org.altbeacon.beaconreference d/referenceapplication﹕ sending notification. 07-01 15:32:40.101 10771-13647/org.altbeacon.beaconreference d/referenceapplication﹕ did exit region 07-01 15:32:59.131 10771-13651/org.altbeacon.beaconreference d/referenceapplication﹕ did enter region.
one more interesting thing note when filter onscanresult in logs see this:
07-01 15:45:49.074 10771-10839/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=24:4b:03:2e:00:d9 rssi=-91 07-01 15:45:49.117 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=00:07:80:1e:7e:b7, rssi=-56 07-01 15:45:49.120 10771-10784/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=00:07:80:1e:7e:b7 rssi=-56 07-01 15:45:49.365 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=62:44:c6:64:4d:a5, rssi=-76 07-01 15:45:49.368 10771-10783/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=62:44:c6:64:4d:a5 rssi=-76 07-01 15:45:59.082 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=62:44:c6:64:4d:a5, rssi=-77 07-01 15:45:59.084 10771-10784/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=62:44:c6:64:4d:a5 rssi=-77 07-01 15:45:59.130 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=00:07:80:1e:7e:b7, rssi=-59 07-01 15:45:59.133 10771-10783/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=00:07:80:1e:7e:b7 rssi=-59 07-01 15:45:59.140 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=24:4b:03:2e:00:d9, rssi=-76 07-01 15:45:59.141 10771-10839/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=24:4b:03:2e:00:d9 rssi=-76 07-01 15:46:09.115 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=00:07:80:1e:7e:b7, rssi=-58 07-01 15:46:09.117 10771-10783/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=00:07:80:1e:7e:b7 rssi=-58 07-01 15:46:09.124 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=24:4b:03:2e:00:d9, rssi=-86 07-01 15:46:09.126 10771-10839/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=24:4b:03:2e:00:d9 rssi=-86 07-01 15:46:09.135 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=62:44:c6:64:4d:a5, rssi=-76 07-01 15:46:09.139 10771-10784/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=62:44:c6:64:4d:a5 rssi=-76 07-01 15:46:19.060 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=24:4b:03:2e:00:d9, rssi=-91 07-01 15:46:19.062 10771-10839/org.altbeacon.beaconreference d/bluetoothadapter﹕ onscanresult() - device=24:4b:03:2e:00:d9 rssi=-91 07-01 15:46:19.092 1425-1495/? d/btgatt.gattservice﹕ onscanresult() - address=00:07:80:1e:7e:b7, rssi=-64
the 00:07:80 device beacon, have no idea whatsoever when 24:4b:03 device is. know how can more data device? possible interfering actual signal? have tried using both
region region = new region("backgroundregion", identifier.parse("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6"), null, null);
and
region region = new region("backgroundregion",null, null, null);
unfortunately random fluctuation both variations.
update:
i ran beaconmanager.setdebug(true) flag activated. here resulting log
update 2:
i switched beacon broadcast ibeacon , problem seemed go away 10 minutes. unfortunately problem returned. looking through logs, seeing quite different now. logs can seen here. assumption problem line:
07-01 21:46:31.035 2499-2499/com.avtar.truckkeeper d/cycledlescanner﹕ cancel wakeup alarm: pendingintent{41f32070: android.os.binderproxy@41d8f750}
any thoughts/help appreciated!
i suspect several things going on based analysis of "resulting log" linked @ bottom of answer:
- the transmitting beacon configured transmit both altbeacon , ibeacon packets.
- the android beacon library has not been configured detect ibeacon packets, default altbeacon packets.
- the transmitting beacon in connectable mode.
- the digiland (p-o-s) tablet can detect 1 packet each distinct bluetooth le device per scan cycle when beacon in connectable mode. (several other android models behave way including nexus 4 , moto g)
- the scan interval has been configured super long -- scan 1 second every 10 seconds.
all of these things creating perfect storm causing these problems:
because of flaw described in (4) , fact beacon in connectable mode described in (3), means 1 packet picked per scan cycle. because beacon sending interleaved advertisements described in (1), means there 50-50 chance packet ibeacon packet. if ibeacon packet, because library has not been configured detect ibeacons described in (2), there no detections in cycle. , because scan cycle 10 seconds long described in 5, cause intermittent region exits , re-entries. (if no beacon seen in 10 seconds, library triggers region exit.)
changing 1 of these things make issue go away:
re-configure beacon turn off ibeacon transmissions (or configure library detect ibeacon transmissions.)
make beacon's connectability timeout shorter -- e.g. after 60 seconds. once no longer connectable, tablet able multiple packets in each scan cycle , problem go away.
reduce length of time of scan cycle. if leave defaults of 1100ms scan time 0ms between scan time in foreground, library have 9 cycles detect beacon before 10 second region timeout fires. 50-50 odds of not detecting beacon in 9 cycles become 0.5^9 = 0.1% chance.
Comments
Post a Comment