-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
my app creates a worker that keeps a connection open with the server and receives messages.
-
When the user navigates away from the app it gets
suspend
ed, which doesn't kill the worker and messages still arrive. -
But when the user leaves pressing the back button, 90% of the times the app
exit
s, the worker gets killed, connection to server cut and messages don't arrive anymore (I guess Android some times decides not to kill it, that's the other 10%).
Is there any cross-platform way to catch that back button event that would exit
the app, and make it minimize, suspend
instead?
In the long term Android will kill the app if the user doesn't interact with it again, and that's ok, I'm just interested in not killing it straight away because of the back button.
I see the application
module has an AndroidActivityBackPressedEventData
with a cancel
property, but I can't find a way to generate the suspend event instead, and in a cross-platform manner.