List of usage examples for android.media.session MediaSession setFlags
public void setFlags(@SessionFlags int flags)
From source file:org.opensilk.video.playback.PlaybackService.java
private MediaSession newMediaSession() { final MediaSession mediaSession = new MediaSession(mContext, "SilkVideoPlayer"); mediaSession .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; }