'Do I need to implement Service for android - ble connection?

I'm developing android app connecting to ble module

I'm testing it with Arduino nano IOT module

So far, app can read/write some data on it but I have read lots of articles and codes that (foreground) Service needs to be applied for the stable connectivity.

I'm not so sure if I really need to implement it.

My scenario is something like below.

  • App will make Ble to run some task

  • BLE device will do the task and send notification of the task progress repeatedly.

  • App will get the noti and show it in the app

  • But when the App go to the background or killed, no need to show the progress. In short, progress will only show within the app

  • if user open the app again, app will reconnect automatically

  • if ble is still sending progress noti, app will catch and show the progress again.

This is Scenario and wonder if I need to implement service to keep connecting.

In my knowledge, I don't need Service for this scenario but dunno if I miss other critical advantages when implementing it.

Could you please share any idea or thought?

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source