-
I couldn't find where this is covered, but how do I handle the case where the user taps on a notification to launch the app? (for both iOS and Android) I want to retrieve the notification details so that I can navigate my webview to the correct URL. I tried this:
But it doesn't appear to work. I'm using MAUI .NET 9 with Plugin.FirebasePushNotifications 3.1.20-pre |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Looking at the example project, the notification includes the click_action and category keys, and then there's an IntentFilter in MainActivity.cs: [IntentFilter(new[] { "medication_intake" }, Categories = new[] { "android.intent.category.DEFAULT" })] Is this the "proper" way to handle app launch from a notification tap? Unfortunately I haven't been able to run the demo project yet, so I'm just relying on code inspection. For my use-case, I only need one behaviour: when the user clicks on a notification, the app should navigate to a specific URL (using an eventId key from the notification). Do I still need to include the click_action in my notification? How can I add a catch-all for every time the user taps on a notification? |
Beta Was this translation helpful? Give feedback.
-
OK, the root cause was because this this line in UseFirebasePushNotifications() was commented : Without that line, tapping on a notification to launch the app does not result in a NotificationOpened event. Once the line is added, the event occurs. I am assuming this meant that the notifications were being correctly trapped and parsed by the library, but ultimately the notification is not queued and hence not handled. I must have commented that out while trying to identify crashing on iOS a couple of weeks ago |
Beta Was this translation helpful? Give feedback.
OK, the root cause was because this this line in UseFirebasePushNotifications() was commented :
o.QueueFactory = new PersistentQueueFactory();
Without that line, tapping on a notification to launch the app does not result in a NotificationOpened event. Once the line is added, the event occurs.
I am assuming this meant that the notifications were being correctly trapped and parsed by the library, but ultimately the notification is not queued and hence not handled.
I must have commented that out while trying to identify crashing on iOS a couple of weeks ago