简体   繁体   中英

Detecting iOS BLE advertising on Android - React Native BLE Advertiser

I've been using react-native-ble-advertiser to try and send string data (the broadcast uuid) between phones, I've managed to get these sharing compatabilities

  1. iOS to iOS 2-way
  2. Android to Android 2-way
  3. Android to iOS 1-way

I'm wondering if perhaps I missed something for BLE as when I try to advertise on iOS I get the warning The advertisement key 'Manufacturer Data' is not allowed in CoreBluetooth however as I said I can detect iOS to iOS. Is there any way to detect iOS on Android?

Below is my configuration taken from the example on the github link above.
The scanning and broadcasting is done at the same time, though I tested without this and still had the issue.

const MANUF_DATA = [1, 0];
BLEAdvertiser.setCompanyId(0x4C);
BLEAdvertiser.broadcast(hash_uuid, MANUF_DATA, {
    advertiseMode: BLEAdvertiser.ADVERTISE_MODE_BALANCED,
    txPowerLevel: BLEAdvertiser.ADVERTISE_TX_POWER_MEDIUM,
    ...
})

BLEAdvertiser.scan(MANUF_DATA, {
    scanMode: BLEAdvertiser.SCAN_MODE_LOW_LATENCY,
})

Does anyone have experience with this package or know of a better way to transmit a string? Open to posting the native code from the package.

Thanks.

Contacted the package developer and it is a known issue with iOS and Apple blocking adjusting CoreBluetooth manufacturer data (the package needs this to scan properly)

"Unfortunately, Apple keeps finding ways to break the advertiser. A few months ago, they started blocking the use of manufacturer data that makes the phone visible to Android and we have not been able to find a way around it yet."

Will continue to resolve this on my own and update if I get a solution or the package is updated:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM