robercoding
07/19/2024, 8:48 AMManifest.xml
file
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/pdf" />
</intent-filter>
And on my MainActivity, I can see the intent with the URI of the pdf file once user send it to my app.
Compose navigation is under official google library.
Question is, how can I handle the uri with navigation in Compose? Is there a way to automatize the process?
All I’ve been able to do is adding a LaunchedEffect(intent) { ... navigator.navigate(...) }
but I definitely dislike the solution…
Is there a known/default approach for these cases?robercoding
07/19/2024, 8:53 AMDisposableEffect(Unit) {
val listener = Consumer<Intent> {
Log.d("AppStart", "onNewIntent: $it")
}
addOnNewIntentListener(listener)
onDispose { removeOnNewIntentListener(listener) }
}
Ian Lake
07/19/2024, 2:04 PMnavDeepLink
API explained in the docs also supports actions and mimeTypes, not just uriPatterns: https://developer.android.com/develop/ui/compose/navigation#deeplinksrobercoding
07/21/2024, 7:10 PMmimeType
option in NavDeepLinkDslBuilder
.
Thank you Ian!!Ian Lake
07/21/2024, 8:11 PMrobercoding
07/26/2024, 5:54 AM