android - Monitoring Listener detects only one beacon -


i have 3 estimote beacons (div kit). in android app i'm trying change 3 textviews show each beacon's major , minor. i've changed beacons settings advertise signal every 1ms shortest period of time.

the problem beaconmanager object detecting 1 beacon , takes while that.

here code

app.java

public class app extends application {      public static beaconmanager mbeaconmanager;      @override     public void oncreate() {         super.oncreate();         mbeaconmanager = new beaconmanager(getapplicationcontext());         mbeaconmanager.setbackgroundscanperiod(timeunit.seconds.tomillis(1), 0);          mbeaconmanager.connect(new beaconmanager.servicereadycallback() {             @override             public void onserviceready() {                 mbeaconmanager.startmonitoring(new region(                         "monitored region",                         uuid.fromstring("b9407f30-f5f8-466e-aff9-25556b57fe6d"),                         null, null));             }         });     } } 

mainactivity.java

@override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         final textview tv = (textview) findviewbyid(r.id.tv);         final textview tv2 = (textview) findviewbyid(r.id.tv2);         final textview tv3 = (textview) findviewbyid(r.id.tv3);          app.mbeaconmanager.setmonitoringlistener(new beaconmanager.monitoringlistener() {             @override             public void onenteredregion(region region, list<beacon> list) {                 tv.settext(list.get(0).getmajor() + " : " + list.get(0).getminor());                 if (list.size() > 1) {                     tv2.settext(list.get(1).getmajor() + " : " + list.get(1).getminor());                 }                 if (list.size() > 2) {                     tv3.settext(list.get(2).getmajor() + " : " + list.get(2).getminor());                 }             }              @override             public void onexitedregion(region region) {                 tv.settext("exit");             }         });     } 

i know code might nonprofessional testing.

hi got same problem resolve problem

beaconmanager.setrangenotifier(new rangenotifier() {         @override                     public void didrangebeaconsinregion(collection<beacon> beacons, region region) {             log.i("test", "detected " + beacons.size());             if (beacons.size() > 0) {                 beaconlist.clear();                 (beacon beacon : beacons) {                     beacon.sethardwareequalityenforced(true);                     beaconlist.add(beacon);                 }             } 

i insert beacon.sethardwareequalityenforced(true);


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -