1. Android Central Question's Avatar
    Developed the following source code for sending message from one Android device to another Android device using BLE: '

    public static String SERVICE_STRING = "6exxxxxx-xxxx-xxxx-xxxx-xxxxxdcca9e";

    public static String CHARACTERISTIC_ECHO_STRING = "6eyyyyyy-yyyy-yyyy-yyyy-yyyyycca9e";

    List serviceList = bluetoothGatt.getServices(); On checking the list of services , on Realme 5 Pro(Android OS 9.0 , BLE v5.0) after a successful connection is established with another device, the list of services is not returning the specific service with service string as mentioned above , hence the following code(BluetoothGattService) is returned as null , so unable to send data to another device via BLE.

    BluetoothGattService service = findService(serviceList);
    if (service == null) {
    Log.i("Null service", "Null service.");
    return matchingCharacteristics;
    }
    private static BluetoothGattService findService(List<BluetoothGattService> serviceList) {
    for (BluetoothGattService service : serviceList) {
    String serviceIdString = service.getUuid()
    .toString();
    if (matchesServiceUuidString(serviceIdString)) {
    return service;
    }
    }
    return null;
    }
    private static boolean matchesServiceUuidString(String serviceIdString) {
    return uuidMatches(serviceIdString, SERVICE_STRING);
    }
    The same source code is returning the list of services with the mentioned service string for other devices like Mi 4a(Android OS 7.0 , BLE 4.0) , Realme 3i(Android OS 9.0, BLE 4.2) and for them , the BluetoothGattService instance is returning the details which is not null and hence able to send messages to other devices.

    Did anyone face the same issue with device with Android OS v9.0 and BLE v5.0 ?
    07-13-2020 02:19 AM
  2. B. Diddy's Avatar
    Welcome to Android Central! I moved this to the Software Development forum for more specific traffic.

    Please register on this forum, which will allow you to engage in discussion more easily, as well as post images. https://forums.androidcentral.com/as...community.html
    07-13-2020 02:22 AM

Similar Threads

  1. Miui Notifications Panel On Any Android
    By mustang7757 in forum General News & Discussion
    Replies: 1
    Last Post: 07-12-2020, 11:19 PM
  2. Recently used app list, can you disable the lower set?
    By Android Central Question in forum Ask a Question
    Replies: 8
    Last Post: 07-12-2020, 04:38 PM
  3. Replies: 2
    Last Post: 07-12-2020, 01:12 PM
  4. Single contact has the same information listed multiple times?
    By acaruthers in forum General Help and How To
    Replies: 4
    Last Post: 07-12-2020, 12:20 PM
  5. What's with Android apps updating frequently?
    By Android Central Question in forum Ask a Question
    Replies: 2
    Last Post: 07-12-2020, 12:16 PM
LINK TO POST COPIED TO CLIPBOARD