Did you find a solution for that? I am stuck in the same situation.
My code looks like this:
final ComponentName receiverComponentName = new
ComponentName(context, MediaControlEventReceiver.class);
context.getPackageManager().setComponentEnabledSetting(receiverComponentName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
getAutioManager().registerMediaButtonEventReceiver(receiverComponentName);
// build the PendingIntent for the remote control client
final Intent mediaButtonIntent = new
Intent(Intent.ACTION_MEDIA_BUTTON);
mediaButtonIntent.setComponent(receiverComponentName);
PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(
context.getApplicationContext(), 0, mediaButtonIntent, 0);
// create the remote control client
remoteControlClient = new RemoteControlClient(mediaPendingIntent);
getAutioManager().registerRemoteControlClient(remoteControlClient);
remoteControlClient.setTransportControlFlags(
RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE |
RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS |
RemoteControlClient.FLAG_KEY_MEDIA_FAST_FORWARD |
RemoteControlClient.FLAG_KEY_MEDIA_REWIND);
and afterwards I call the remoteControlClient.setPlaybackState()
methods and set the meta data.
The ICS lock screen doesn't care at all (have tested on a Galaxy
Nexus).
The funny thing is, that in the ICS sources of the music application
everything related to the RemoteControlClient seems to be commented
out:
http://android.git.r3pek.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/MediaPlaybackService.java;h=d8ac015452c0a084383a27983c025a54afe75ec1;hb=HEAD
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en