This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Android-BLE-Library development

Hi:

    We has a device use the hid keyboard and privacy gatt Service. Now we development the app with Android-BLE-Library, and  can not to resolve some question.

    1.      While get the remote device name with call BluetoothDevice.getName(),  the library return the short name but not the full name.

    2.     How to enable the hid keyboard service by default? while connected to ios is enable auto.

Thanks!

 Sam

Parents
  • Hi,

    Indeed, iOS reads the Device Name characteristic on it's own after connection. Android, I think, does not. Instead, it exposes Generic Access service to the user (iOS does not), so you may read this characteristic after connection on your own, or often also write a value to change the name. We don't recommend using BluetoothDevice.getName() as it's using a cached name. For advertising packets is always better to use a name from the advertising data: https://developer.android.com/reference/android/bluetooth/le/ScanRecord.html -> getName().

    Regarding the second issue, when a HID device is bonded it should be enabled automatically. HID service is available form Android 4.4 onward. Perhaps you may have to initiate bonding from Android Settings -> [Connected Devices ->] Bluetooth.

    Hope that helped,

    Aleksander

  • Hi, Aleksander:

        The first issue is solve already.

        Regarding the second issue, just as you said HID device is enabled automatically if initiate bonding from android Setting by manual.
         But, if we use the Android-Scanner-Compat-Library and Android-BLE-Library to initial bonding, the HID device is not enabled automatically.
        Can we do it by software, just like iPhone enabled it automatically after nRF52832 is bonded with android phone? And how to do?
    Thanks!
    Sam
Reply
  • Hi, Aleksander:

        The first issue is solve already.

        Regarding the second issue, just as you said HID device is enabled automatically if initiate bonding from android Setting by manual.
         But, if we use the Android-Scanner-Compat-Library and Android-BLE-Library to initial bonding, the HID device is not enabled automatically.
        Can we do it by software, just like iPhone enabled it automatically after nRF52832 is bonded with android phone? And how to do?
    Thanks!
    Sam
Children
Related