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:
parent
a806d58966
commit
b227c12f39
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue