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

1 peripheral (nRF) 1 central (iOS or Android) but 2 concurrent apps

Following situation:

My device acts as central (connecting to ble sensors) and as peripheral (transmitting and receiving data from mobile). Several services (Heart Rate, Speed and Cadence...) are implemented to suit most apps on Android and iOS, but I need an additional application to handle notifications (transmitting from mobile to device). As far as I can see, I have no possibility to connect with 2 apps to one gatt server... any solutions to this problem?

I know it's not a nordic specific question...but maybe I'm missing the point. Is there a sweet solution for this setup? As I'm implementing device and app I'm not limited to one side, except that stock apps should still see a heart rate and speed/cadence service.

best regards, Michael

Parents
  • Hi Michael,

    I don't think you can share same server between apps.

    But may I ask why you need to have a separated app to handle notification, can't a background service of the same app do that ?

Reply
  • Hi Michael,

    I don't think you can share same server between apps.

    But may I ask why you need to have a separated app to handle notification, can't a background service of the same app do that ?

Children
  • Yes, I could implement a service with an AIDL interface (on Android) for example, but I would loose the functionality to connect my device to apps which already support basic ble profiles. All apps would have to implement my custom AIDL or my custom service. And that's bad :(

  • @Michael: Are you telling that you want to access the server created by third party apps from your app ? I don't think GATT server should be that easy to access. But I do agree there should be an option to share GATT server data/task if needed.

  • @Hung Bui: The idea behind the device is to be a Hub for ANT and BLE devices like HRM, Speed/Cadence and so on. This is a main feature and it's needed to be compliant with apps like Strava or other tracking apps, which already implemented a HRM, Speed/Cadence profile. As a second feature I have to implement a way to transmit notifications to my device, a phone call for example. Therefor 2 concurrent apps need access to my device.

  • Hmm, then I don't really get it.

    What is the problem of 2 concurrent apps to access to your device ? There should be no problem for 2 apps to connect to one same device (problem was two apps sharing same gatt server).

    You can create your own Gatt server in your app and handle notification there. This has nothing to do with other apps that acts as client, Strava for example.

    Another option is you use your app as a client, the server is on your device, and then when you want to send data from the phone to the device, you can use write command/request.