Replies: 3 comments 7 replies
-
@HenrikJannsen as per your request, see the above linked with #172 . Let me know if you need any clarifications please |
Beta Was this translation helpful? Give feedback.
-
When app is in foreground I guess its weird to get a system notification. Better to add some UI layer as we have in Bisq 2 with the notification badges or banner. For iOS the suggested notification solution would not work as there is nothing like a ForegroundService available, right? Moving all domain services into a ForegroundService might make the ForegroundService the main app. How would the interaction between the ForegroundService and the UI app work? It seems Android made the ForegroundService more restrictive over time. As far I read our use case would not really match the intended use of ForegroundService. Also the user can stop it (from Android 10 on). I am not sure if we need to support the case where the app got terminated. Bisq users also need to get back to their app when they have active trades open. For the clients the backend node would send the notification as we do in Bisq 1 (sending it to a relay node). I guess we can re-use that relay infrastructure without much effort. The backend node can be expected to run constantly. I would suggest:
For the case that the back-end node send the notification we need to figure out how to let the back-end node know that the app is terminated. But I guess that should be easy as the websocket connection fails in that case. For the terminated node app case, there might be another solution which would require more investigation if its feasible, but I want to share the rough idea: We could run a foreground service but not as Bisq 2 domain services, but as a lightweight REST api client which polls in a certain interval from some Bisq 2 infrastructure node (like the oracle node or a new dedicated one) for mailbox messages. When starting the foreground the node app passes its key IDs which are used in the mailbox messages to identify which message is addressed to us. If any mailbox message arrives which has a matching key ID, the foreground service sends a system notification waking up the Bisq app. It does not know about the content as that would require the decryption key and the code base to de-serialize the protobuf message, but it knows that some message arrived for that user. Actually it would not require the mailbox message at all but only the key ID, so the REST API service could extract the key IDs of all mailbox messages send those as reply to the requester. Such a service could alternatively run as a headless node, either by the user or as a Bisq service where mobile users could register for notifications, but that would have privacy issues as that node would learn about the correlation of the mobile users device ID and the key ID and with the frequency of the messages the activity level of that user. |
Beta Was this translation helpful? Give feedback.
-
@HenrikJannsen yes, for the node having a foreground service running everything is a no-go, it will drain the battery. I'm thinking we could use something like the WorkManager scheduling period open trade verifications when there are open trades for the user. Turns out it can reliable run even if the app has been killed. The only case it won't work is if the user goes to the app settings and force-kill it which is very unlikely. And this would also work for iOS I'll try to put together a quick version of this.. |
Beta Was this translation helpful? Give feedback.
-
Foreground
This is working out of the box. Ideally a different UI instead of showing the user a system notification, but for MVP we are ok like this.
Background
typical example is the user switch to another app (e.g. he received a notification from other app and clicked on it putting our app in background, or he received a phone call)
This is also working out of the box as long as the OS doesn't kill the app
App gets Killed
Either the user kills it or the OS does it for performance reasons, this is an scenario that needs to be consider in mobile.
For this scenario, we need to leave a service on that will continue to receive ongoing trades (either user offers that might receive a taker or trades that are open that involve the user) updates so that it can generate a notification that the user can click to return to the app. When the user returns to the app it should work normally as it would doing a fresh cold start.
Node
For the Node we only need Android Support, which has a specific component to tackle this case called "Foreground Service". If could manage to leave the bisq services that update the open trades on (linked to this foreground service currently called NotificationServiceController in the apps) that should do it because any updates that occur, the service will generate a system notification for the user to come back to the app and continue the trade
xClients
For the clients, the service that runs in the background even when the app gets killed would need to maintain WS comms with the bisq2 node and do the same thing stated above.
Beta Was this translation helpful? Give feedback.
All reactions