I want to start Google Assistant with a query (or without any) when the user clicks a button, could not find any reference to doing this task.
I tried calling the following function, as I found in the documentation of Google Assistant but I do not understand how to use it for my Application:
@Override
public void onProvideAssistContent(AssistContent assistContent) {
super.onProvideAssistContent(assistContent);
String structuredJson = new JSONObject()
.put("@type", "MusicRecording")
.put("@id", "https://example.com/music/recording")
.put("name", "Album Title")
.toString();
assistContent.setStructuredData(structuredJson);
}
It does nothing, even when I long press home screen button to open Google Assistant, and select option what's on my screen it shows nothing.
If this is not possible, can I add the same action as Long Press Home does, i.e. open Google Assistant; to my button?