You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
ably.Push.notificationEvents.setOnBackgroundMessage(StateTestNotification.backgroundMessageHandler);
classStateTestNotification {
staticFuture<void> backgroundMessageHandler(ably.RemoteMessage message) async {
print('---------------- Just received a background message, with:');
print('RemoteMessage.Data: ${message.data.toString()}');
bool delayResult =awaitFuture.delayed(Duration(milliseconds:1), () {
returntrue;
});
print('delay result: $delayResult');
print('at end of backgroundMessageHandler');
}
}
When I look at the logs using logcat I see:
---------------- Just received a background message, with:
RemoteMessage.Data: {increment: {"mydata": "here"}}
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?
The text was updated successfully, but these errors were encountered:
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?
The text was updated successfully, but these errors were encountered: