Search code examples
androidiosactionscript-3air

Air iOS/Android push notification remember when app launches


I have an app built for iOS and Android which has push notifications. Everything is working great however I was wondering if there is a way to store the data of the push notification in the app so that when users launch the app after receiving a notification I can show them the message again?

Basically I allow users to share information and/or chat amongst their friends. If they receive a notification when the app is in the background it comes through as a normal push message but when they launch the app I would like to direct them to the chat feature to see the message again.

I am storing the messages sent in a remote DB but seeing as they have already received the payload it doesn't make much sense for the app to call the remote DB to retrieve the same message.

I am using Distriqt's extensions in AS3 and Air 3.5.

Cheers


Solution

  • I asked Distriqt's support for the same thing a few weeks ago and they explained that there is no way to get the information of the push notification message while the app is closed so they suggested this : - when the user opens the app, you call your server to check if they haven't missed anything, and get the data from there. If there has been a push, you display the push message as if it was received with the app in the foreground.

    It's a bit tricky and not very satisfying but it works.. As long as the user follows the path. If your user receives the push and chooses not to open your app, he will still get the push message in your app next time he opens it.