I faced another question about implementing Toastbar for the push notification on iOS.
The problem is that when the push() method is called, the display is always in foreground. Therefore, when you receive the push notification while the app is in background, and then click the notification - when the app opens into foreground, it shows the toastbar as well. It shouldn't - toastbar must be shown only if the app was in foreground at the moment of receiving of push.
I tried checking the app state by adding
Display.getInstance().isMinimized() statement and I keep a value in Preferences which is set to show toast when the
start() method is called and not to show toast when the
stop() method is called.
To compare, the order of methods in Android is following:
-> Click on push notification in the notification drawer (because the preference is set to background it shows the notification) ->
-> App calls push() and shows me the form that I want it to show - >
-> App calls start() and the Preference is getting set to foreground (show me a toastbar in the future).
As a result, Android has the proper behavior when I click on the push notification.
iOS logic is reversed - when you press the notification,
-> App calls start(), and then
-> App calls push() .
So when app gets to the push method, it always thinks that the app was previously in a foreground.
I'll appreciate any suggestions. Thank you!