Am referring to https://github.com/AltBeacon/android-beacon-library-reference for my project.
Through the documentation and some comments, I figured out that they by default they receive altBeacon signal. I wanted to know, how can we personalize it to read other different beacon formats such as Eddystone and iBeacon.
As it's open source i'll like to stick to it and later personalize(update) accordingly.
For example we need to set the beacon layout using below code :
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
Edit: I changed the setBeaconLayout part of the code,as suggested in an answer. Still it's not working.
I used the following piece of code(Am referring to https://github.com/AltBeacon/android-beacon-library-reference). I added those setBeaconLayout
part to receive eddystone signal which sadly,am not receiving. But if I remove the same, I can receive altBeacon signals.
public void onCreate() {
super.onCreate();
BeaconManager beaconManager = org.altbeacon.beacon.BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().clear();
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT)); //for Eddystone...
Log.d(TAG, "setting up background monitoring for beacons and power saving");
Region region = new Region("backgroundRegion",null, null, null);
regionBootstrap = new RegionBootstrap(this, region);
backgroundPowerSaver = new BackgroundPowerSaver(this);
}
Can anyone help me in this? How do I make my app receive eddystone signal?
P.s Can someone also give a list of sample setBeaconLayout
part for different signals. Am assuming that if we just change that part, we can receive signals (for the signal format for which we set the layout.
Many Thanks in advance.