I am developing a messaging app using ionic/cordova for Android and iOS. So far it is working great with the push notifications (except when I used the manifest check button in the configuration page, it suggested several modifications to the manifest that were causing the app to crash when it got a notification, turns out that the manifest after the plugin installation is good enough, maybe the manifest check tool needs an update :D).
What I want to do is have a have a different behaviour in these two situations:
1) The app is opened and the user gets a push, nothing happens in the UI and the custom data is handled in the background, the user will just see that a notification arrived in the notification bar up top. e.g. User is typing a message to his friend and a message from another friend arrives, the push is receive to notify the user but he stays on the same chat session.
2) The app is closed or in the background and the user gets a push, when he clicks on it the user is automatically taken to the app, but now the user is taken to the chat session the message came from. e.g. User is not on the app, then a message from a friend arrives, when he clicks on it he is taken to the chat session that message is from.
So in short, I don't want the user to be taken to the other chat screen when he is on the app. I know how to take the user to the other screen, but don't know how to differentiate the two situations inside the function that handles the push-notification event.
If you guys could help me finding a way to do this, I would be extremelly grateful :D
Please sign in to leave a comment.