This MR introduces a background service for the card10 app. This has the following advantages:
- BLE connection is kept alive even when the activity is killed, improving stability
- connection status is shown in notification
- one central point for connection management, independent of hardware specifics
- makes features that require a continuous BLE connection possible (notifications, current time service)
The GUI has been updated to reflect these changes. In particular:
- connection (i.e. background service) can be turned on and off
- (un-)pairing is only possible when disconnected
- cleaner (and explicit) state model (not paired, paired but disconnected, connecting, connected)
Since there are no automated tests, I manually tested all features. Everything worked as before.
Small technicality: In Android terms, what this is using is a Foreground Service. This requires a notification, but the system will not kill it (or at least, very very rarely). I still call it the card10 background service, since that makes more sense.