Skip to content Skip to sidebar Skip to footer

Mediabrowsercompat.connect() Never Calls Onconnected Or Any Mediabrowsercompat.connectioncallback Method

I am trying to connect my activity to a MediaBrowserServiceCompat service using MediaBrowserCompat. This is my activity: @Override protected void onCreate(Bundle savedInstanceState

Solution 1:

In my case, I had an issue with public IBinder onBind(Intent intent) function in the service class. It should not return null. I just removed the override of the function and it solved the issue.

Solution 2:

Setting sessionToken in service onCreate worked for me.

Solution 3:

This worked for me:

setSessionToken(mediaSessionCompat.getSessionToken());

and

@Nullable@Override
public IBinder onBind(Intent intent) {
    if (SERVICE_INTERFACE.equals(intent.getAction())) {
        returnsuper.onBind(intent);
    }
    returnbinder;
}

Post a Comment for "Mediabrowsercompat.connect() Never Calls Onconnected Or Any Mediabrowsercompat.connectioncallback Method"