I am using Radius networks altbeacon library in my android app , but whenever i broadcast altbeacon from locate app , my app cant detect the altbeacon .
This is my 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 is my 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 with startIndex: 5, endIndex: 29
06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome D/BeaconParser: This is not a matching Beacon advertisement. (Was expecting be ac. The bytes I see are: 02011a1aff4c0002152f234454cf6d4a0fadf2f4911ba9ffa600000000c50000000000000000000000000000000000000000000000000000000000000000
whenever i transmit altbeacon from locate app in my iphone the below code is printed in logcat many times for my android app , but the main concern is , didRangeBeaconsInRegion() function is never called , and my code in the function is not executed i.e my android app cant detect altbeacon ( transmitting from 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 for 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 I am 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);
// this tells the library that we want to know about any beacon we see.
try {
mBeaconManager.startMonitoringBeaconsInRegion(region);
} catch (RemoteException e) {
e.printStackTrace();
}
//The last line sets the rangeNotifier to this class,
//so our the same RangingActivity class will get callbacks each time a beacon is seen.
mBeaconManager.setRangeNotifier(this);
}
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> collection, Region region) {
for(Beacon beacon : collection)
{
Log.d(TAG, "Beacon detected with id1: " + beacon.getId1() + " id2:" + beacon.getId2() + " id3: " + beacon.getId3() + " distance: " + beacon.getDistance());
((TextView)beacon_transmit_detect.this.findViewById(R.id.message)).setText("Beacon detected with 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 my main class implements BeaconConsumer,RangeNotifier .