cordova-plugin-ble-peripheral icon indicating copy to clipboard operation
cordova-plugin-ble-peripheral copied to clipboard

Hello problem startingAdvertising on Android 8 devices

Open elysiopires opened this issue 6 years ago • 3 comments

Hello!

Does anyone have a workaround to Android 8 devices?

I try to create a service like the given example, on Android 7 devices work great, on Android 8 devices is not working at all. When I try to search for the service created I got no result.

Motorola G5 Version 8.0.1

Thanks for your help!

Sincerely, Elysio

elysiopires avatar Oct 15 '18 17:10 elysiopires

I can confirm. Same problem on Samsung Galaxy 8 (android v8.0.0). Central -> ESP32 (standard BLE uart example) Peripheral -> Samsung Galaxy 8 (android v8.0.0) running UART example from this repository (defect in 'blePeripheral.startAdvertising(SERVICE_UUID, 'UART')' ).

@don ,can you please help? Many thanks in advance.

Best regards, Raymond

rayholland avatar Jan 11 '19 21:01 rayholland

I found that my bluetooth device name was too big for the advertising data. Once I changed that I could get it to work.

You can also check the value of the failure returned at https://developer.android.com/reference/android/bluetooth/le/AdvertisingSetCallback

1 was my error code and it was mapped to https://developer.android.com/reference/android/bluetooth/le/AdvertisingSetCallback.html#ADVERTISE_FAILED_DATA_TOO_LARGE

darkedges avatar Jan 01 '20 00:01 darkedges

Thank you. You really saved my day. Setting

        builder.setIncludeDeviceName(false);

in the private AdvertiseData getAdvertisementData declaration in BLEPeripheralPlugin.java did indeed make everything work.

THANK YOU !!!

jdexyz avatar Mar 27 '20 02:03 jdexyz