Setup: I am using android-ble-library for my android app. I am using modified blinky example on embedded side. I have tried following implementation on android app:
- I have followed blinky android app, and so used viewmodel implementation. i.e accessing Ble Manager from ViewModel.
Problem: When I start a new activity, I lose the connection and do not understand how I can use this viewmodel implementation accross multiple activities.
What I am able to do so far is, I have 3 fragments in my activity, I share the same viewmodel accross all these fragments, and it works perfect. But what I would like to have is, different activites handling different features of my embedded application. For example, 1 activity handling only my data transfer service, 2nd activity handling device configuration service, and perhaps 1 activity handling dfu. But I want to connect to my embedded device only once using the scanner activtiy.
Is it possible using viewmodel implementation? or should I consider using the service implementaion as in CSC from android nrf toolbox app?