-
Notifications
You must be signed in to change notification settings - Fork 439
How to handle on resume in Vue? Non-firebase messaging only #1460
Comments
I have dug into this further. Everything is working and onMessageReceived is running, but vue.$navigateTo has no effect in this state (app is closed and notification is tapped). I have tried this inside of both created() and mounted() and it doesn't make a difference. But if I wrap the navigateTo in a timeout, it works. So it seems to have to do with firebase running onMessageReceived before vue is ready for it to. Is there a fix for this? |
Perhaps this is better asked in the nativescript-vue repo as it's more about the Vue lifecycle related to an iOS appdelegate event rather than specific to this plugin (and I don't have the answer). |
You are correct. I was not sure if it was a race condition between the two technologies though. I got iOS working last night by solving the race condition, but the fix doesn't make "sense" to me.... I moved all of the firebase stuff into a hook that runs when the app is more fully loaded and it solved it. But it doesn't make sense really....only the onMessageReceived was affected - and it is running after the app re-launches, not when the message is received, so it's hard to understand what's "happening" behind the scenes. I was going to close this myself once I solved android because I am not convinced it is the same issue, and not sure if there is an issue or not yet. I will report back, thank you @EddyVerbruggen |
Uh oh!
There was an error while loading. Please reload this page.
I don't think this is a bug but I haven't seen this documented anywhere. I am trying to handle a notification. In Ios, the problem is when the app is not running at all and a notification comes in, and is "tapped". The app simply goes to the home screen. In Android, the same thing happens, but even when the app is in background mode. I have seen fixes for this in angular, but I'm not sure if I understand how to implement this in nativescript-vue. The combination of these two technologies is rendering my searches somewhat useless.
My guess is that I need the onMessageReceived callback to attach the data to something in my vue model, I'm just not sure what. Then I need to access this on resume, but I don't get how?
Just looking for someone who maybe has figured this out to let me in on the secrets? Hopefully this thread helps others, too. Thanks.
The text was updated successfully, but these errors were encountered: