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

Writing to Immediate Alert characteristic not working

I am using a nrf51822 based tag and Android official SDK to implement my custom app. I perform the following steps:

    1. Scan
    2. Connect
    3. Discover services
    4. Write 0X01 to immediate alert characteristic

Here is the code

 BluetoothGattService alertService = mBluetoothGatt.getService(BleDefinedUUIDs.Service.IMMEDIATE_ALERT_UUID);
 BluetoothGattCharacteristic alertLevel = alertService.getCharacteristic(BleDefinedUUIDs.Characteristic.ALERT_LEVEL_UUID);
 alertLevel.setValue(1, BluetoothGattCharacteristic.FORMAT_UINT8, 0);       
 boolean status=mBluetoothGatt.writeCharacteristic(alertLevel);

I get value of status as true. Now the tag should beep. But that doesn't happen. Also when I perform the same operation via a 3rd party app in play store it does work. Can you kindly help me out with this issue? Thanks in advance

Parents
  • Hi

    You should be able to connect to the ble_app_proximity application with nRF Toolbox Proximity app for Android and Master Control Panel for Android.

    In nRF Toolbox Proximity app, bond should be automatically made when you connect to the device. Now you can press Button 1 on the nRF51-DK to send immediate alert to the phone. The nRF Toolbox source code is available on Nordic's Github, so perhaps you can see in that source code how things are set up.

    Sometimes when you have connected previously to different BLE services, those services are still present in the GATT table on the phone. You then need to go into Settings/options on your Android phone, choose Bluetooth and then select any bonded devices and select "forget" for each one.

Reply
  • Hi

    You should be able to connect to the ble_app_proximity application with nRF Toolbox Proximity app for Android and Master Control Panel for Android.

    In nRF Toolbox Proximity app, bond should be automatically made when you connect to the device. Now you can press Button 1 on the nRF51-DK to send immediate alert to the phone. The nRF Toolbox source code is available on Nordic's Github, so perhaps you can see in that source code how things are set up.

    Sometimes when you have connected previously to different BLE services, those services are still present in the GATT table on the phone. You then need to go into Settings/options on your Android phone, choose Bluetooth and then select any bonded devices and select "forget" for each one.

Children
No Data
Related