I'm developing an App using BLE and I need to be able to connect to Android and iOS devices.
I have 3 Samsung Devices, 3 iPhones and one Huawei with Android for testing purposes.
I have an issue with the Huawei device..when scanning for advertisements, Huawei finds all Android devices but no iOS ones. But if I turn bluetooth off and on again, it will find the iOS devices this time if I scan. But only the first time, it won't find them again afterwards until I turn bluetooth off/on again.
Again..only the Huawei is having these issues..what can be the cause?
I scan/advertise like this:
val settings = AdvertiseSettings.Builder()
.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED)
.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM)
.setConnectable(true)
.build()
val pUuid = ParcelUuid(UUID.fromString(BluetoothStringsValues.SERVICE_UUID))
val data = AdvertiseData.Builder()
.setIncludeDeviceName(false)
.addServiceUuid(pUuid)
.addServiceData(pUuid, stringToAdvertise.toByteArray(Charset.forName("UTF-8")))
.build()
advertiser.startAdvertising(settings, data, advertisingCallback)
val filter = ScanFilter.Builder()
.setServiceUuid(ParcelUuid(UUID.fromString(SERVICE_UUID)))
.build()
val settings = ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_BALANCED)
.build()
bluetoothLeScanner.startScan(listOf(filter), settings, bleScanCallback)
thanks for the help!