Android Question BLE DataAvailable doesn't start and Setnotify error

Marco Maria Vilucchi

Active Member
Licensed User
Hi all,
i'm trying to implement BLE with an ESP32 chip.
I'm waiting that DataAvailable routine starts, but nothing
All characteristich are enabled for notify (see nRF screenshot)
when I try to enable notify in my app
    manager.SetNotify(S, C300_comando, True)
    Log("Notify ok "&C300_comando)
    Log("SetNotify failed "&C300_comando)
 End Try
I always have SetNotify failed.
If I don't use try catch I have this error:
starter_manager_connected (java line: 218)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothGattDescriptor.setValue(byte[])' on a null object reference
    at anywheresoftware.b4a.objects.BleManager2.setNotify(
    at anywheresoftware.b4a.objects.BleManager2.SetNotify(
    at b4a.example.starter._manager_connected(
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(
    at anywheresoftware.b4a.BA$
    at android.os.Handler.handleCallback(
    at android.os.Handler.dispatchMessage(
    at android.os.Looper.loop(
    at java.lang.reflect.Method.invoke(Native Method)

In this thread:
Erel says
Based on the error message the characteristic you specified doesn't support notifications.
But on nRF screenshot we can see NOTIFY
what mistake can there be?


  • Screenshot_20190710-073332_nRF Connect.jpg
    Screenshot_20190710-073332_nRF Connect.jpg
    412.3 KB · Views: 69


Well-Known Member
Licensed User
dows it work using nRF connect?
liks a test, I remember that I actived notify in nRF connect then read the data with b4a app.
Upvote 0


Licensed User
With nRF Connect and a BLE pressure sensor here, the pressure reading (labelled "Unknown Characteristic") has two "icons" to read data: the single down-arrow will do a single reading (ie, equivalent to BLE2 library ReadData call) and the multiple down-arrows will enable notifications (ie, equivalent to BLE2 library SetNotify true call).

Your nRF Connect screen is not showing the multiple-down-arrows icons. I think that is a clue that perhaps the ESP32 notifications need something else to be done before they work. Perhaps they need to be given some data to send? Perhaps there are some other settings associated with notifications, like a minimum-time-between-changes or something? I do not know exactly, I am just making guesses that I hope will spur an "aha!" moment when you suddenly remember reading some cryptic note in the datasheet.

You could experiment manually with the ESP32 via RealTerm, get just one characteristic working with notifications and showing the multiple-down-arrows icon in nRF Connect. Once you have a set of ESP32 AT commands that reliably creates a notifiable characteristic, then you can duplicate those commands to create all 30 of your characteristics.

"Easy!"... (from afar, anyway)


Upvote 0


Well-Known Member
Licensed User
using nrf connect i can connect device and see characteristics but I don't know how to do anything else.
But for you is better use notify or timers?
I'm not sure if it'll work, try to do that test:
start nRf connect, Connect to your module and click in the ↓↓↓ after that start your app and try to read.

also can you share more information.
Upvote 0