I'm using Jetpack Navigation. I need to handle deeplinks manually because:
1) Implicit deeplinks are not working properly with android:launchMode="singleTask"
Deeplink isn't correctly redirect if the app is already opened
2) I'm passing in my bundles not only simple types but also Parcelables, so I won't have the possibility to pass arguments
I've done proof of concept that is using explicit deeplinkins in onNewintent
of my Activity
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
val data: Uri? = intent?.data
if(data?.lastPathSegment == "discover") {
val pendingIntent = NavDeepLinkBuilder(this)
.setGraph(R.navigation.nav_main)
.setDestination(R.id.discover_dest)
.createPendingIntent()
pendingIntent.send()
}
}
It works on my phone, but to be honest, it smells. Is it an intended way to use Jetpack Navigation explicit deeplinks? Can I handle manually Jetpack Navigation deeplinks in the nicer way?