altbeacon - Cannot Detect Alt-beacon in android -
i using radius networks altbeacon library in android app , whenever broadcast altbeacon locate app , app cant detect altbeacon .
this beacon parser :-
mbeaconmanager.getbeaconparsers().add(new beaconparser().setbeaconlayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
this android studio logcat :-
06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome d/beaconparser:ignoring pdu type 01 06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome d/beaconparser: processing pdu type ff: 02011a1aff4c0002152f234454cf6d4a0fadf2f4911ba9ffa600000000c50000000000000000000000000000000000000000000000000000000000000000 startindex: 5, endindex: 29 06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome d/beaconparser: not matching beacon advertisement. (was expecting ac. bytes see are: 02011a1aff4c0002152f234454cf6d4a0fadf2f4911ba9ffa600000000c50000000000000000000000000000000000000000000000000000000000000000
whenever transmit altbeacon locate app in iphone below code printed in logcat many times android app , main concern , didrangebeaconsinregion() function never called , , code in function not executed i.e android app cant detect altbeacon ( transmitting locate app in myiphone ):-
06-11 11:44:38.669 18053-18072/optimus.com.optimusiothome d/scanrecord: parsefrombytes 06-11 11:44:38.669 18053-18072/optimus.com.optimusiothome d/scanrecord: first manudata manu id 06-11 11:44:38.669 18053-18072/optimus.com.optimusiothome d/bluetoothlescanner: onscanresult() - scanresult{mdevice=69:86:de:dd:64:1d, mscanrecord=scanrecord [madvertiseflags=26, mserviceuuids=null, mmanufacturerspecificdata={76=[2, 21, 47, 35, 68, 84, -49, 109, 74, 15, -83, -14, -12, -111, 27, -87, -1, -90, 0, 0, 0, 0, -59]}, mservicedata={}, mtxpowerlevel=-2147483648, mdevicename=null], mrssi=-55, mtimestampnanos=97773873478375}
and using following dependency in android gradle :-
compile 'org.altbeacon:android-beacon-library:2.7'
some more code :-
@override public void onbeaconserviceconnect() { region region = new region("all-beacon-region",null,null,null); // tells library want know beacon see. try { mbeaconmanager.startmonitoringbeaconsinregion(region); } catch (remoteexception e) { e.printstacktrace(); } //the last line sets rangenotifier class, //so our same rangingactivity class callbacks each time beacon seen. mbeaconmanager.setrangenotifier(this); } @override public void didrangebeaconsinregion(collection<beacon> collection, region region) { for(beacon beacon : collection) { log.d(tag, "beacon detected id1: " + beacon.getid1() + " id2:" + beacon.getid2() + " id3: " + beacon.getid3() + " distance: " + beacon.getdistance()); ((textview)beacon_transmit_detect.this.findviewbyid(r.id.message)).settext("beacon detected id1: " + beacon.getid1() + " id2:" + beacon.getid2() + " id3: " + beacon.getid3() + " distance: " + beacon.getdistance()); } } @override protected void onresume() { super.onresume(); mbeaconmanager=beaconmanager.getinstanceforapplication(this.getapplicationcontext()); mbeaconmanager.getbeaconparsers().add(new beaconparser().setbeaconlayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25")); mbeaconmanager.bind(this); }
and main class implements beaconconsumer,rangenotifier .
here list of main beacon layouts check if layout correct one.
altbeacon "m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"
eddystone tlm "x,s:0-1=feaa,m:2-2=20,d:3-3,d:4-5,d:6-7,d:8-11,d:12-15"
eddystone uid "s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19"
eddystone url "s:0-1=feaa,m:2-2=10,p:3-3:-41,i:4-20v"
ibeacon "m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"
a reference list here.
Comments
Post a Comment