Skip to content

Commit 09b4d99

Browse files
committed
DO NOT MERGE Fix 5389442 RemoteControlClient javadoc
Extend RemoteControlClient class description with an example of instance creation showing how the PendingIntent is created and how it uses the same ComponentName as the one used in AudioManager.registerMediaButtonEventReceiver() Change-Id: I1af61ddbf5cfb9160ea5b814bed7b881d51b7eff
1 parent 99f3668 commit 09b4d99

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

media/java/android/media/RemoteControlClient.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,27 @@
3535
import java.lang.IllegalArgumentException;
3636

3737
/**
38-
* TODO javadoc update for ComponentName - PendingIntent change
3938
* RemoteControlClient enables exposing information meant to be consumed by remote controls
4039
* capable of displaying metadata, artwork and media transport control buttons.
41-
* A remote control client object is associated with a media button event receiver. This
40+
*
41+
* <p>A remote control client object is associated with a media button event receiver. This
4242
* event receiver must have been previously registered with
4343
* {@link AudioManager#registerMediaButtonEventReceiver(ComponentName)} before the
4444
* RemoteControlClient can be registered through
4545
* {@link AudioManager#registerRemoteControlClient(RemoteControlClient)}.
46+
*
47+
* <p>Here is an example of creating a RemoteControlClient instance after registering a media
48+
* button event receiver:
49+
* <pre>ComponentName myEventReceiver = new ComponentName(getPackageName(), MyRemoteControlEventReceiver.class.getName());
50+
* AudioManager myAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
51+
* myAudioManager.registerMediaButtonEventReceiver(myEventReceiver);
52+
* // build the PendingIntent for the remote control client
53+
* Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
54+
* mediaButtonIntent.setComponent(myEventReceiver);
55+
* PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
56+
* // create and register the remote control client
57+
* RemoteControlClient myRemoteControlClient = new RemoteControlClient(mediaPendingIntent);
58+
* myAudioManager.registerRemoteControlClient(myRemoteControlClient);</pre>
4659
*/
4760
public class RemoteControlClient
4861
{

0 commit comments

Comments
 (0)