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

Android: Read characteristic without service discovery

We are writing an Android app for our own peripheral (nRF51-based). We know the handles for all the characteristics.

On Android gatt.discoverServices() needs to be called, and wait for onServicesDiscovered(), then getServices(), before the Characteristic object is available.

This is very time-consuming, and often onServicesDiscovered() does not get called (despite connection success).

Is there a way to directly to write to an attribute handle or a characteristic UUID, bypassing all the discovery steps?

Parents Reply
  • That is a very good question. I can always get the services using the nRF MCP app. In fact, after initiating connection from my app, when it gets GATT_CONNECTED, and I then switch over to MCP, it shows the peripheral as connected as well, and I can even do discover services from MCP, successfully. The Android recommended procedure is so simple (call discoverServices upon getting newState == GATT_CONNECTED in onConnectionStateChange), I don't even have any other options to try.

Children
No Data
Related