Closed asoap closed 11 months ago
➤ Automation for Jira commented:
The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3946
I managed to fix this. I've created a pull request which you can find here: https://github.com/ably/ably-flutter/pull/498
Thank you for raising this and for sending over your PR @asoap. We'll get back to you on it very shortly 😄
When getting a background notification while the app is in a dead state. I can see Ably launching the app and I see the background notification execute. But I'm having an odd issue where I want to do a few things. Like updating some counters in stored local storage and updating the app's badge icon. All of these which use asyn/await to know when to continue. I investigate the code execution on Android using logcat I see the app dying before the function completes.
I see the app waking, I see it login via our webserver getting it's ably token, connecting to ably, and then getting the background message. It then starts executing the background message only for it to stop when it gets to an await. Under my normal code it was kind of a mix on which await would cause it to stop. Some awaits would execute, others would end the function. So I created a test to confirm it wasn't me.
When I look at the logs using logcat I see:
The rest of the prints() are missing. It always dies when it sees a delay of one millisecond.
Is there any way around this? Am I doing something wrong?