From my app, I’d like to be able to launch the new Google Gemini android app (as installed from the app store) and provide an initial query/question. I’m currently able to launch the app, but I can’t find any information on if there is an intent extra that is supported. I’m able to accomplish this with both ChatGPT and Copilot using a url with a query parameter for the initial question.
Here is my current code for launching Gemini:
val pkg = "com.google.android.apps.bard"
val act = "com.google.android.apps.bard.shellapp.BardEntryPointActivity"
val intent = Intent(Intent.ACTION_MAIN).apply {
setClassName(pkg, act)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
if (text != null) {
intent.putExtra(SearchManager.QUERY, datextta) // doesn't work
intent.putExtra("android.intent.extra.TEXT", text) //doesn't work
}
if (intent.resolveActivity(activity.packageManager) != null) {
activity.startActivity(intent)
}