From 484fbe3bddef6df831458d1bfdf958f0d079b3ee Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 10 Dec 2013 00:39:05 +0100 Subject: [PATCH] Fixed notification being permanently updated. --- .../controldlna/mediarouter/MediaRouterPlayService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java b/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java index 1488719..af7ccea 100644 --- a/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java +++ b/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java @@ -227,6 +227,9 @@ public class MediaRouterPlayService extends Service { mSessionId = data.getString(MediaControlIntent.EXTRA_SESSION_ID); mItemId = data.getString(MediaControlIntent.EXTRA_ITEM_ID); mPollingStatus = true; + + new CreateNotificationTask().execute(mPlaylist.get(mCurrentTrack) + .getFirstPropertyValue(DIDLObject.Property.UPNP.ALBUM_ART_URI.class)); } }); } @@ -306,16 +309,14 @@ public class MediaRouterPlayService extends Service { new ControlRequestCallback() { @Override public void onResult(Bundle data) { - MediaItemStatus status = MediaItemStatus.fromBundle(data); + MediaItemStatus status = MediaItemStatus.fromBundle(data); + if (mRouterFragment.get() != null) mRouterFragment.get().receivePlaybackStatus(status); if (status.getPlaybackState() != MediaItemStatus.PLAYBACK_STATE_PENDING && status.getPlaybackState() != MediaItemStatus.PLAYBACK_STATE_BUFFERING && status.getPlaybackState() != MediaItemStatus.PLAYBACK_STATE_PLAYING) stopForeground(true); - else - new CreateNotificationTask().execute(mPlaylist.get(mCurrentTrack) - .getFirstPropertyValue(DIDLObject.Property.UPNP.ALBUM_ART_URI.class)); if (status.getPlaybackState() == MediaItemStatus.PLAYBACK_STATE_FINISHED) { if (mCurrentTrack + 1 < mPlaylist.size())