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

Android BLE Library

Hi, our current Android application is based on nrf uart app example and we want to restart an implementation based on template example on top of BleManager library. Could you tell us if it respects new behaviors changes on background and service of android 8.0 (developer.android.com/.../android-8.0-changes)
Thanks
Parents
  • Hi ,

    First of all, I highly recommend switching to BLE Library. In fact, the version 2 of it, which is now in beta6 phase, will very soon be the only maintained version, so please use this one. Despite the beta in the name, it's well tested and has more features then 1.2.

    nRF Toolbox uses this beta version on *develop* branch.

    However, the BLE Library only handles the connection. It may be used in a service, in view model (or repository inside), in an activity for some simple use cases, etc. On its own it doesn't care about how it's being used, so also does nothing regarding the changes in Android Oreo.

    On the other hand, the nRF Toolbox, which is using this library, should care about all those issue, and should start its services as foreground service. It has been pointed today: https://github.com/NordicSemiconductor/Android-nRF-Toolbox/issues/57 that it isn't doing that, and the running service will be likely killed 5 minutes after the app went to background. I'll fix it before the nRF Toolbox *develop* is merged to *master*.

    You may also check [nRF BLinky](https://github.com/NordicSemiconductor/Android-nRF-Blinky), which is using Architecture Components and is handling the connection from the View Model. But in that case we don't support background connection at all, that's why it's possible.

    Hope that answers your questions,

    Aleksander

Reply
  • Hi ,

    First of all, I highly recommend switching to BLE Library. In fact, the version 2 of it, which is now in beta6 phase, will very soon be the only maintained version, so please use this one. Despite the beta in the name, it's well tested and has more features then 1.2.

    nRF Toolbox uses this beta version on *develop* branch.

    However, the BLE Library only handles the connection. It may be used in a service, in view model (or repository inside), in an activity for some simple use cases, etc. On its own it doesn't care about how it's being used, so also does nothing regarding the changes in Android Oreo.

    On the other hand, the nRF Toolbox, which is using this library, should care about all those issue, and should start its services as foreground service. It has been pointed today: https://github.com/NordicSemiconductor/Android-nRF-Toolbox/issues/57 that it isn't doing that, and the running service will be likely killed 5 minutes after the app went to background. I'll fix it before the nRF Toolbox *develop* is merged to *master*.

    You may also check [nRF BLinky](https://github.com/NordicSemiconductor/Android-nRF-Blinky), which is using Architecture Components and is handling the connection from the View Model. But in that case we don't support background connection at all, that's why it's possible.

    Hope that answers your questions,

    Aleksander

Children
Related