Example usage for android.media.session MediaSession setSessionActivity

List of usage examples for android.media.session MediaSession setSessionActivity

Introduction

In this page you can find the example usage for android.media.session MediaSession setSessionActivity.

Prototype

public void setSessionActivity(@Nullable PendingIntent pi) 

Source Link

Document

Set an intent for launching UI for this Session.

Usage

From source file:org.opensilk.video.playback.PlaybackService.java

private MediaSession newMediaSession() {
    final MediaSession mediaSession = new MediaSession(mContext, "SilkVideoPlayer");
    mediaSession// w  ww.  j  av a 2  s .co  m
            .setFlags(MediaSession.FLAG_HANDLES_MEDIA_BUTTONS | MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
    final ComponentName mediaButtonComponent = new ComponentName(mContext, MediaButtonReceiver.class);
    final PendingIntent mediaButtonIntent = PendingIntent.getBroadcast(mContext, 1,
            new Intent().setComponent(mediaButtonComponent), PendingIntent.FLAG_UPDATE_CURRENT);
    mediaSession.setMediaButtonReceiver(mediaButtonIntent);
    mediaSession.setSessionActivity(makeActivityIntent(null));
    return mediaSession;
}