Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Push notifications open to specific state while app in background

$
0
0

@jack2 wrote:

I have an app with a chat component, and I would love users to be able to click on a new message push notification while my app is in the background and have the app open up and immediately go to the correct conversation.

This is easy for simple cases (onNotification, read the payload, run $state.go etc), where the app was moved to the background in a clean state. If the user was doing any of the following actions when they paused the app, then you have some hoops to jump through:

1. Plugins
If my user was using a plugin with a UI component like the camera or datepicker plugins, and the plugin was still visible when they paused the app, then the new state will open, but the plugin UI will be on top. Plugins have a .show() method, but they don't normally have a .close() method. The user has to manually close it.

2. Modals
If the user had a modal open, then the new state will open, however the notification will be in the foreground. I am trying to handle this by broadcasting 'closeAllModals' in the onNotification method. Each modal controller then has an $on('closeAllModals') event which checks if any modals are open and if so it calls modal.remove().

3. Popups
If any popups are open, then this will also appear over the new state. Once again, this can be handled with a broadcast to close the visible popups.

Does anyone have a better way of handing these issues? Is there any way to say that the modal/popup/plugin should only be visible while that particular view is the active view?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>