adb shell am start -a "android.search.action.GLOBAL_SEARCH" --es query \"The Incredibles\"
import static android.support.v4.content.IntentCompat.EXTRA_START_PLAYBACK; public class SearchableActivity extends Activity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getIntent() != null) { // Retrieve video from getIntent().getData(). boolean startPlayback = getIntent().getBooleanExtra(EXTRA_START_PLAYBACK, false); Log.d(TAG, "Should start playback? " + (startPlayback ? "yes" : "no")); if (startPlayback) { // Start playback. startActivity(...); } else { // Show details for movie. startActivity(...); } } finish(); } }
adb shell 'am start -a android.intent.action.VIEW --ez android.intent.extra.START_PLAYBACK true -d <URI> -f 0x14000000'
adb shell 'am start -a android.intent.action.VIEW --ez android.intent.extra.START_PLAYBACK true -d content://com.example.android.assistantplayback/video/2 -n com.example.android.assistantplayback/.SearchableActivity -f 0x14000000'
public class MyMediaSessionCallback extends MediaSessionCompat.Callback { private final PlaybackTransportControlGlue<?> mGlue; public MediaSessionCallback(PlaybackTransportControlGlue<?> glue) { mGlue = glue; } @Override public void onPlay() { Log.d(TAG, "MediaSessionCallback: onPlay()"); mGlue.play(); updateMediaSessionState(...); } @Override public void onPause() { Log.d(TAG, "MediaSessionCallback: onPause()"); mGlue.pause(); updateMediaSessionState(...); } @Override public void onSeekTo(long position) { Log.d(TAG, "MediaSessionCallback: onSeekTo()"); mGlue.seekTo(position); updateMediaSessionState(...); } @Override public void onStop() { Log.d(TAG, "MediaSessionCallback: onStop()"); // Handle differently based on your use case. } @Override public void onSkipToNext() { Log.d(TAG, "MediaSessionCallback: onSkipToNext()"); playAndUpdateMediaSession(...); } @Override public void onSkipToPrevious() { Log.d(TAG, "MediaSessionCallback: onSkipToPrevious()"); playAndUpdateMediaSession(...); } }