Navigating to a route after tapping a notification
See original GitHub issueIs there a way I can make the app launch a specific route other than the home after I tap a notification? Or navigate to a route after I tap the notifcation?
im doing this to register the callback for tapping a notification:
ngOnInit() {
LocalNotifications.addOnMessageReceivedCallback((notification) => {
this.routerExtension.navigate(["/details", notification.id]);
})
}
But i get this error: Navigation triggered outside Angular zone, did you forget to call ‘ngZone.run()’?
I tried wrapping it around ngZone.run() but I still get the same error:
ngOnInit() {
LocalNotifications.addOnMessageReceivedCallback((notification) => {
this._zone.run(() => {
this.routerExtension.navigate(["/details", notification.id]);
})
})
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Flutter: FCM — How to Navigate to a Particular Screen After ...
In this post, I'll go over how to receive FCM Push Notifications and then push a particular page when the user taps on...
Read more >Navigate to screen after opening a notification? - Stack Overflow
Best way to handle navigation on notification opening is to handle them in a splash screen. this will give ...
Read more >Start an Activity from a Notification - Android Developers
When you start an activity from a notification, you must preserve the user's expected navigation experience. Tapping Back should take the ...
Read more >Open app in specific view when push notification is tapped
(Notice that after tapping the push notification, the app moves to the ... and then the navigation controller, and finally the specific view ......
Read more >Turn Google Maps notifications on or off - Android
To check things that interest you, like train schedules or traffic on routes you travel often, turn on notifications in the Google Maps...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If this is an issue on Android only, try adding this
launchMode
to<activity android:launchMode="singleTask"
inAndroidManifest.xml
.Had the same issue and was able to make it work with NgZone.
Add the function to
app.component.ts
and invoke it inngOnInit
.I’m not 100% sure if this is something that can be corrected. Since the library is made to work with any NS platform, it will run outside Angular’s zone, unless it is specifically redesigned for Angular.
Angular 7.2.15
Core 5.4.3
local-notifications 3.2.2