I'm currently using AltBeacon library to develop my app on Android.
I need to identify which advertising device has sent the beacon from the scanning device's point-of-view. So, I am thinking of using bluetooth MAC address to check the advertising device.
Using the library, my callback for RangeNotifier
is called when a collection of beacons are found as below:
@Override public void didRangeBeaconsInRegion(Collection beacons, Region region) { for (Beacon b : beacons) { System.out.println(b.getBluetoothAddress()); } }
After testing, I noticed that getBluetoothAddress()
does not match the bluetooth MAC address of the advertising device.
On the advertising device, I'm obtaining the bluetooth MAC address as follow:
public String getMacAddress() { BluetoothAdapter.getDefaultAdapter().getAddress(); }
My questions are therefore:
- Am I wrong to assume that the
Beacon
'sgetBluetoothAddress()
differs from the advertiser's bluetooth MAC address? If different, what address isBeacon
returning? - How can I get what the advertising device's Beacon.getBluetoothAddress() is before advertising?
- Any other suggestions on identifying advertising device (other than using bluetooth MAC address) would be appreciated.