Fix binding issues by only using the MediaBrowserService onBind when the intent's action is MediaBrowserService and otherwise returning the LocalBinder.

This commit is contained in:
Meir Schwarz 2016-07-02 01:13:27 -07:00
parent a806d58966
commit b227c12f39
1 changed files with 7 additions and 1 deletions

View File

@ -209,6 +209,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
private static volatile MediaType currentMediaType = MediaType.UNKNOWN;
private final IBinder mBinder = new LocalBinder();
public class LocalBinder extends Binder {
public PlaybackService getService() {
return PlaybackService.this;
@ -384,7 +386,11 @@ public class PlaybackService extends MediaBrowserServiceCompat {
@Override
public IBinder onBind(Intent intent) {
Log.d(TAG, "Received onBind event");
return super.onBind(intent);
if(intent.getAction() != null && intent.getAction().equals("android.media.browse.MediaBrowserService")) {
return super.onBind(intent);
} else {
return mBinder;
}
}
@Override