0
votes

I want to transmit iBeacon data packet from android phone, with data flag.

Data Flag (0x01) is Bluetooth GAP specification that represents beacon's capability.

My situation:

Currently, I'm trying to advertise using BluetoothLeAdvertiser. But it doesn't works as I thought. I found that, I can only advertise "Manufacturer specific data".

BluetoothManager manager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
mBluetoothAdapter = manager.getAdapter();
mBluetoothLeAdvertiser = mBluetoothAdapter.getBluetoothLeAdvertiser();

// Settings here

mBluetoothLeAdvertiser.startAdvertising(settings, getAdvertiseData(), mAdvertiseCallback);


My current result:

enter image description here


What I want:

Common iBeacon data packet(Image below) has data flag, Type 0x01. And I want to add this flag to my iBeacon advertise packet.
That means, I want add Raw data "0x020106" to head part of the packet.
How can I archive this?

enter image description here


Etc:

I have already read about question below, but it doesn't help for my problem.
Can an Android device act as an iBeacon?


Also, I already have read that android ble api doesn't support Data flag.
But the comment was in 2015, is there any hopeful changes now?

https://github.com/AltBeacon/android-beacon-library/issues/141

Unfortunately, this is not currently allowed by the Android BLE APIs, so the library cannot this.


Any help will be appreciated. Thank you.

1
iBeacon is part of Apple's own BLE. There was a legal wrangle over the AltBeacon support library and Apple not so long ago, if memory serves correctly.t0mm13b
Thanks for your comment, t0mm13b. I understand. My point is, can i add "Data flag (0x01)" with "Manufacturer specific data (0xFF)" in my "Beacon packet" ?Stanley Ko
Have you actually tried it first?t0mm13b
I tried "iBeacon format", "Alt beacon format" and sending beacon packet was successful. But I failed to add "Data flag". I want add Raw data "0x020106" to my beacon packet. Can I archive this?Stanley Ko

1 Answers

1
votes

Unfortunately, Android's Java BLE APIs expose no way of doing this. I researched this topic to answer the Android Beacon Library Issue you referenced. The Java APIs only let you advertise either service data or manufacturer data. They are simply not flexible enough to let you specify any other advertising PDUs. This has not changed as of May 2016.

You might be able to do what you want by dropping down to a lower level and talking to C BlueDroid APIs. But doing this would require a rooted device and perhaps installing a custom Android OS image to give you access.