Could anybody give mi an example of using Activity.onProvideAssistContent(), new in Android 6.0?
2 Answers
For example for Music file you will use MusicRecording type from Schema.org in such way:
@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);
}
Full lists of JSON parameters you can find here Schema.org. And to play with JSON without need to compile app - JSON-LD site.

- 10,333
- 4
- 30
- 47
Adding to Tajchert's answer, it's part of the Assist API. I just saw the new documentation for this new feature in Android Marshmallow. It's here: http://developer.android.com/training/articles/assistant.html
With a long press on the home button or saying the keyphrase the assistant shows a window with contextually relevant actions for the current activity. These potential actions might include deep links to other apps on the device.
This link provides an example of using Activity.onProvideAssistContent(): http://developer.android.com/training/articles/assistant.html#source_app

- 1
- 1

- 10,686
- 1
- 38
- 46