Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Yeah, Navigation doesn't change the Intent at all, so the default behavior of Android is to maintain the Intent across activity restarts. We should save the fact that we've already handled the Intent to prevent this issue on recreation.
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 50331e2040ea746f041a2ecee8466e826b0daed8
Author: jbwoods <jbwoods@google.com>
Date: Tue May 28 16:33:53 2019
Ensure the Activity Intent is handled only once
After we handle the Activity Intent, we should save the fact that it has
already been handled. This ensures we do not keep re-handling the intent
when the activity is restarted.
Test: Added test
BUG: 132754763
Change-Id: Ie4133eb3abfbfc00a1862f89019845a8bbc3123c
M navigation/runtime/src/androidTest/java/androidx/navigation/NavControllerActivityTest.kt
M navigation/runtime/src/main/java/androidx/navigation/NavController.java
https://android-review.googlesource.com/971168
https://goto.google.com/android-sha1/50331e2040ea746f041a2ecee8466e826b0daed8
Branch: androidx-master-dev
commit 50331e2040ea746f041a2ecee8466e826b0daed8
Author: jbwoods <jbwoods@google.com>
Date: Tue May 28 16:33:53 2019
Ensure the Activity Intent is handled only once
After we handle the Activity Intent, we should save the fact that it has
already been handled. This ensures we do not keep re-handling the intent
when the activity is restarted.
Test: Added test
BUG: 132754763
Change-Id: Ie4133eb3abfbfc00a1862f89019845a8bbc3123c
M navigation/runtime/src/androidTest/java/androidx/navigation/NavControllerActivityTest.kt
M navigation/runtime/src/main/java/androidx/navigation/NavController.java
jb...@google.com <jb...@google.com> #4
This has been fixed internally and will be available in the Navigation 2.1.0-alpha05 release.
br...@gmail.com <br...@gmail.com> #5
I'm using navigation 2.1.0-alpha05 and I still see this issue, in some cases. It doesn't happen always. For example, if I click a deeplink in an email in the Gmail app, everything works great. My app loads, the deeplink intent is handled and I go to the right destination. I can then "go back" and then background the app. And when I bring it back to the foreground from the Recents screen, it loads up where I left off (i.e. the intent is NOT rehandled). However, if I use the Google Messages app and follow the exact same procedure, the issue listed in this ticket happens (i.e. the deeplink gets rehandled over and over, each time I foreground the app and I wind up on the deep link destination every time).
il...@google.com <il...@google.com> #6
Re #5 - please create a new issue with a sample project that reproduces your issue.
Description
Version used: 2.1.0-alpha03
Devices/Android versions reproduced on: Pixel XL Android 9
If needed I'll build a sample project but it's a behavior I have on multiple project.
Assuming my app is a simple master list, that can navigate to a detail fragment.
It can receive firebase notification that will contains an id to an element of the list. I want that on notification click, it launch the detail fragment from graph.
Here's the code I use to generate the notification:
val notificationId = news.id.hashCode()
val pendingIntent = NavDeepLinkBuilder(context)
.setDestination(R.id.newsDetailFragment)
.setArguments(NewsDetailFragmentArgs(
.setGraph(R.navigation.nav_main)
.setComponentName(MainActivity::class.java)
.createPendingIntent()
val notification = NotificationCompat.Builder(context, "notifications")
.setSmallIcon(R.drawable.ic_notif)
.setContentTitle(news.title)
.setContentText(news.excerptToString)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.build()
val manager = NotificationManagerCompat.from(context)
manager.notify(notificationId, notification)
This code works well, the notification goes to the detail, using back button, i can come back to main screen then exits.
Except that when I use the "recent apps" button of the phone and brings the app again, instead of starting to main list scren, it brings back the detail screen (and pressing back display main list, then exits, and we can do it again and again...)
The only way to clear the start intent is to relaunch the app from the launcher instead.
I found a 2016 stackoverflow post about deeplink but I think that things weren't as we expect them to work today.
I don't think this should be the normal behavior, but if this is not a bug because of how deep link works, can you at least hint a solution on the
Tell me if you need a full sample or a video I will update the post.