Activity.onProvideAssistContent () example
Can anyone give mi an example using Activity.onProvideAssistContent () new in Android 6.0?
source to share
Adding to Tajchert's answer , it is part of the Assist API. I just saw new documentation for this new feature in Android Marshmallow. Here: http://developer.android.com/training/articles/assistant.html
When you long press the home button or say a key phrase, the assistant displays a window with context-sensitive actions for the current activity. These potential actions could include deep links to other apps on the device.
This link gives an example using Activity.onProvideAssistContent (): http://developer.android.com/training/articles/assistant.html#source_app
source to share
For example, for a music file, you would use MusicRecording like this:
@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 can be found here on Schema.org . And play with JSON without having to compile the application - JSON-LD .
source to share