Example usage for android.media RemoteControlClient setPlaybackState

List of usage examples for android.media RemoteControlClient setPlaybackState

Introduction

In this page you can find the example usage for android.media RemoteControlClient setPlaybackState.

Prototype

public void setPlaybackState(int state) 

Source Link

Document

Sets the current playback state.

Usage

From source file:com.andrew.apollo.MusicPlaybackService.java

private static void remoteControlClientSetPlaybackStateTask(RemoteControlClient rc, int playState) {
    try {//from ww  w .ja v  a2  s .c  o m
        rc.setPlaybackState(playState);
    } catch (Throwable throwable) {
        // rare android internal NPE
    }
}

From source file:net.nightwhistler.pageturner.fragment.ReadingFragment.java

@TargetApi(19)
private void setMetaData() {

    RemoteControlClient localRemoteControlClient = (RemoteControlClient) this.remoteControlClient;

    RemoteControlClient.MetadataEditor editor = localRemoteControlClient.editMetadata(true);

    editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, authorField.getText().toString());
    editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, bookTitle);

    editor.apply();/*www.  java  2  s.com*/
    //Set cover too?

    localRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);

    LOG.debug("Focus: updated meta-data");
}