I am working on Android trying to search/find beacons nearby and I am using Altbeacon Android library.
The beacon is custom and here is the manufacturer specific:
//---------------flags data type------------------------------------------------
// FLAGS data type
typedef PACKED_STRUCT
{
uint8_t len; // # bytes for data type (but not including len field)
uint8_t type; // 0x01
uint8_t attrib; // 0x06
} flags_data_t;
//---------------manufacturer specific data ------------------------------------
#define BLE_MFG_SPECIFIC_DATA_TYPE 0xff
// company identifiers of interest
#define BLE_COMPANY_ID_SOMECOMPANY 0x0312
// Manufacturer specific data (msd) header
typedef PACKED_STRUCT
{
uint8_t len; // # bytes for data type (but not including len field)
uint8_t type; // 0xff for manufacturer specific
uint16_t company_id; // Bluetooth org registered company id, use Enlighted
} msd_data_header_t;
I need to get all the beacon of nearby location for this particular manufacturer.
Android code is:
beaconManager.getBeaconParsers().add(new BeaconParser() .setBeaconLayout("m:2-3=0312,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
@Override
public void onBeaconServiceConnect() {
final Region region = new Region("myBeaons", Identifier.parse(UUID), null, null);
beaconManager.setMonitorNotifier(new MonitorNotifier() {
@Override
public void didEnterRegion(Region region) {
try {
Log.d(TAG, "didEnterRegion");
beaconManager.startRangingBeaconsInRegion(region);
} catch (RemoteException e) {
e.printStackTrace();
}
}
@Override
public void didExitRegion(Region region) {
try{
Log.d(TAG, "didExitRegion");
beaconManager.stopRangingBeaconsInRegion(region);
} catch (RemoteException e) {
}}
@Override
public void didDetermineStateForRegion(int i, Region region)
{
Log.d(TAG, "didDetermineStateForRegion");
}
});
beaconManager.setRangeNotifier(new RangeNotifier() {
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
for (Beacon oneBeacon : beacons) {
Log.d(TAG, "distance: " + oneBeacon.getDistance() + " id:" + oneBeacon.getId1() + "/" + oneBeacon.getId2() + "/" + oneBeacon.getId3());
}
}
});
try {
beaconManager.startMonitoringBeaconsInRegion(region);
} catch (RemoteException e) {
e.printStackTrace();
}
}
But not able to find any beacon,please suggest me how can i do this or is their any other library