Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this the correct layout to detect iBeacons with AltBeacon's Android Beacon Library?

I have successfully modified the reference implementation app of the Android Beacon Library using the following beacon layout, so that it detects an iBeacon device that I have at hand:

public class MainActivity extends Activity {     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         BeaconManager beaconManager = BeaconManager.getInstanceForApplication(this);         beaconManager.getBeaconParsers().add(new BeaconParser().                setBeaconLayout("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24"));         beaconManager.bind(this);     } } 

Being new to the internals of BLE packets, I'm not sure if this is the correct layout to use. The library endorses the AltBeacon standard and its documentation does not mention how to detect iBeacon devices.

  • Will this code detect all iBeacon devices? i.e. is the m: prefix too restrictive or is it the right byte sequence that matches the iBeacon spec?
  • Similarly, does the rest of the layout exactly match the iBeacon spec?

Reference:

  • Example of an iBeacon packet seen on SO
like image 502
ento Avatar asked Jul 30 '14 02:07

ento


People also ask

Can Android detect iBeacon?

The Android OS does not have any code that detects iBeacons, but it does have code that allows you to scan for Bluetooth LE devices, which are a lower-level device than an iBeacon. You can roll-your own code that detects iBeacons using this Bluetooth LE scanning.

How does iBeacon work?

How iBeacon works. The beacon's job is to continuously scan for smartphones and tablets that have Bluetooth open and are running the beacon's compatible mobile app. When such a device comes within range, the beacon sends a connection request to wake up the app.

Can I use my phone as a beacon?

YES This is possible on Android 5+, and you can find open-source code for transmitting as a beacon in the Android Beacon Library. There is also a full-featured version of a beacon transmitter in the Beacon Scope app in the Google Play Store.


1 Answers

This worked for me: "m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"

I don't think you need to match the 4c00 part because that is the manufacturer id, so you can probably leave that off and start with m:2-3=0215 Everything else looks right, and it seems to work.

like image 72
mobiledevbrick Avatar answered Sep 17 '22 13:09

mobiledevbrick