-
Notifications
You must be signed in to change notification settings - Fork 540
Migration of BluetoothMeshService and application state into foreground service #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Migration of BluetoothMeshService and application state into foreground service #227
Conversation
that looks like an awesome change, thank you. the foreground service should make it run a lot more reliably over a long time period? I'm not quite happy with the styling of the notification, it looks unfinished. what do you think of changing it to a vanilla notification that maybe only shows the number of peers? |
Yes, this allows the service to run within a foreground service that does not need UI to run. It will then hook in to the UI when it is launched via the launcher or notification. Yeah the custom UI is a bit overkill :) If you all are interested in this, I can take some time to clean it up with a vanilla implementation. |
yeah I've tested and it and it seems to work. can certainly use more support from experienced android devs like you. a few things / questions:
I think it needs a bit of polishing but it feels very powerful |
…ock user function for testing.
Agreed, the back button and notification take care of this.
The BluetoothMeshService will be shutdown when the process/activity/viewmodel is paused and eventually garbage collected. With a service, it can stay alive in that background process and then the UI can live in an activity that binds to the service to retrieve application state. This is how media apps work, the player is in a service.
Yeah so thats a force close and an unknown app state, the notification is there but the process its connected to is dead. Reopening and re-initialization of the app is expected since it died. I'm not sure how to detect this state off the top of my head.
We can put whatever we want in it. The bluetooth service and all its dependencies will live there. And then any state you need for the foreground notification (peer data, message data, etc0
Yeah I think we will need to integrate DMs into the foreground service UI. I have stubbed that out. I've done a bunch of cleanup real quick. it looks like I need to rebase and check out DMs 👍 |
# Conflicts: # app/src/main/java/com/bitchat/android/MainActivity.kt # app/src/main/java/com/bitchat/android/ui/ChatScreen.kt
Okay so I believe ive restored the DM notifications,, we arent tied to the primary foreground service for notifications. We can also easily make a custom layout for the foreground service that can handle routing directly to DMs. There will be more work needed on audio/vibration notifications around the foreground service and DMs. |
Sorry I have been busy! I will get back to rebasing this at some point! |
Description
The proper way to implement this sort of scanner is in a foreground service that can be managed by notifications and bound UI. I migrated to this architecture along with implementing proper UI to disconnect to/from the foreground service from the application layer.
Screenshots
Checklist