#Retrieving Android Intent Extras in Tauri 2

6 messages · Page 1 of 1 (latest)

unique coyote
#

I'm using Tauri 2 for an Android app and need to access Intent extras (e.g., a URL or config string) that are passed to the app. Is there a built-in way to retrieve these extras directly in Rust? Or is the recommended approach still to handle them in MainActivity (Kotlin)? Additionally, is there any more convenient or recommended approach to passing parameters into the Tauri app when it’s launched from a custom launcher (other than relying on Android intent extras)?

Thank you!

unique coyote
#

I managed to retrieve the data I needed from the intent in MainActivity.kt, but now I can’t figure out how to pass it to Rust in the entry point.

slim rune
#

not sure if that's possible with the mainactivity but if you use a plugin you can use tauri's apis to send stuff to the rust side

#

check out the deep link plugin for example

unique coyote
#

I didn't use any plugins. Here's a sample code that successfully retrieves extra fields passed in the launch intent. Now, I would like to somehow pass the required URL to Rust.

android.util.Log.d("MainActivity", "onCreate: Activity started!")
val uri = intent?.data
if (uri != null) {
    android.util.Log.d("MainActivity", "Got intent data: $uri")
    Companion.urlFromIntent = uri.toString()
} else {
    android.util.Log.d("MainActivity", "No intent data (uri is null)")
}
slim rune
#

I didn't use any plugins
Yeah i got that. I'm just saying maybe you should. And i don't mean any of the existing ones but creating your own (can be inlined into the main app). I just don't know how to get access to the tauri apps outside of a plugin.