I am using Nexus 4(4.4 kitkat) as central and iPad as peripheral.Peripheral has a service which it is advertising.The advertising packet has some data(22bytes) + service UUID.When I try to scan for the peripheral from Android, iPad peripheral is discovered.However when I try to get the service UUID from scanRecord parameter in the callback, I could not find it.All I get is the 20byte data which the peripheral is sending.When I try to scan for devices with the UUID I am not able to discover those peripherals.
Following is the iOS code to advertise a service.The service id being used is "0000192f-0000-1000-8000-00805f9b34fb"
CBUUID *serviceUuid = [CBUUID UUIDWithString:TRANSFER_SERVICE_UUID];
[self.peripheralManager startAdvertising:@{CBAdvertisementDataServiceUUIDsKey : @[serviceUuid],
CBAdvertisementDataLocalNameKey:[[BTLEConfigs sharedBTLEConfig] getAdvertizingUUID]}];
The device gets discovered when I scan without service UUID.
// Device scan callback.
private BluetoothAdapter.LeScanCallback mLeScanCallback =
new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device, int rssi, final byte[] scanRecord) {
runOnUiThread(new Runnable() {
@Override
public void run() {
//-- how to retrieve the service id from scanRecord
}
});
}
};
The services are discovered between two iOS devices but between Android device and iOS peripheral its not working.How to scan a peripheral with 16bit service UUID?Any help is appreciated.