Example usage for android.media.session MediaSession setFlags

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

Introduction

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

Prototype

public void setFlags(@SessionFlags int flags) 

Source Link

Document

Set any flags for the session.

Usage

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;
}