diff --git a/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java b/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java index 2636a3e7..27f4a354 100644 --- a/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java +++ b/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java @@ -1444,7 +1444,7 @@ public class DownloadServiceImpl extends Service implements DownloadService audioManager.registerRemoteControlClient(remoteControlClient); } - Log.i(TAG, String.format("In updateRemoteControl, playerState: %s", playerState)); + Log.i(TAG, String.format("In updateRemoteControl, playerState: %s [%d]", playerState, getPlayerPosition())); switch (playerState) { @@ -1514,6 +1514,15 @@ public class DownloadServiceImpl extends Service implements DownloadService Log.e(TAG, "Exception in updateRemoteControl", e); } } + else + { + if (remoteControlClient != null) + { + remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED); + audioManager.unregisterRemoteControlClient(remoteControlClient); + remoteControlClient = null; + } + } } private synchronized void bufferAndPlay()