RemoteControlClient
public
class
RemoteControlClient
extends Object
| java.lang.Object | |
| ↳ | android.media.RemoteControlClient |
This class was deprecated
in API level 21.
Use MediaSession instead.
RemoteControlClient enables exposing information meant to be consumed by remote controls capable of displaying metadata, artwork and media transport control buttons.
A remote control client object is associated with a media button event receiver. This
event receiver must have been previously registered with
AudioManager.registerMediaButtonEventReceiver(ComponentName) before the
RemoteControlClient can be registered through
AudioManager.registerRemoteControlClient(RemoteControlClient).
Here is an example of creating a RemoteControlClient instance after registering a media button event receiver:
ComponentName myEventReceiver = new ComponentName(getPackageName(), MyRemoteControlEventReceiver.class.getName()); AudioManager myAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); myAudioManager.registerMediaButtonEventReceiver(myEventReceiver); // build the PendingIntent for the remote control client Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON); mediaButtonIntent.setComponent(myEventReceiver); PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, PendingIntent.FLAG_MUTABLE_UNAUDITED); // create and register the remote control client RemoteControlClient myRemoteControlClient = new RemoteControlClient(mediaPendingIntent); myAudioManager.registerRemoteControlClient(myRemoteControlClient);
Summary
Nested classes | |
|---|---|
class |
RemoteControlClient.MetadataEditor
This class was deprecated
in API level 21.
Use |
interface |
RemoteControlClient.OnGetPlaybackPositionListener
Interface definition for a callback to be invoked when the media playback position is queried. |
interface |
RemoteControlClient.OnMetadataUpdateListener
Interface definition for a callback to be invoked when one of the metadata values has been updated. |
interface |
RemoteControlClient.OnPlaybackPositionUpdateListener
Interface definition for a callback to be invoked when the media playback position is requested to be updated. |