Workaround for #17

This commit is contained in:
daniel oeh 2012-09-26 15:33:01 +02:00
parent 33a1d78c38
commit 916a382b37
1 changed files with 9 additions and 3 deletions

View File

@ -927,8 +927,14 @@ public class PlaybackService extends Service {
PendingIntent mediaPendingIntent = PendingIntent.getBroadcast( PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(
getApplicationContext(), 0, mediaButtonIntent, 0); getApplicationContext(), 0, mediaButtonIntent, 0);
remoteControlClient = new RemoteControlClient(mediaPendingIntent); remoteControlClient = new RemoteControlClient(mediaPendingIntent);
int controlFlags;
if (android.os.Build.VERSION.SDK_INT < 16) {
controlFlags = RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE | RemoteControlClient.FLAG_KEY_MEDIA_NEXT;
} else {
controlFlags = RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE;
}
remoteControlClient remoteControlClient
.setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE); .setTransportControlFlags(controlFlags);
return remoteControlClient; return remoteControlClient;
} }
@ -963,9 +969,9 @@ public class PlaybackService extends Service {
.editMetadata(false); .editMetadata(false);
editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE,
media.getItem().getTitle()); media.getItem().getTitle());
editor.putLong( /* editor.putLong(
MediaMetadataRetriever.METADATA_KEY_DURATION, MediaMetadataRetriever.METADATA_KEY_DURATION,
media.getDuration()); media.getDuration());*/
editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM,
media.getItem().getFeed().getTitle()); media.getItem().getFeed().getTitle());