SeekTo does not trigger onPlaybackStateChanged in MediaControllerCompat
<p>I have this media player and everything else works properly, I start the song, it gets through 2 states, the last one being <code>PlaybackStateCompat.STATE_PLAYING</code></p>

<p>Therefore we can say the callback is registered. The problem is whenever I trigger the SeekBar listener, the method <code>seekTo</code> does not trigger the <code>onPlaybackStateChanged</code> and because this does not happen, I cannot update the SeekBar to its new progress. This only concerns the UI. The music actually is playing from the progress after modifying the SeekBar progress. What's more, the trackDurationTextView doesn't get updated either. It changes its value while I'm dragging my thumb across the seek bar but once I release it, it goes to its initial progress, same as the seek bar.</p>

<p>Here is where there callback is registered.</p>

<pre><code>@Override
    public void onServiceConnected(ComponentName componentName, IBinder service) {
        if (service instanceof MediaPlayerService.ServiceBinder) {
            try {
                mediaController = new MediaControllerCompat(this, ((MediaPlayerService.ServiceBinder) service).getService().getMediaSessionToken());
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            mediaController.registerCallback(mMediaControllerCallback);
        }
    }
</code></pre>

<p>This is how the callback is initialized:</p>

<pre><code> private MediaControllerCompat.Callback mMediaControllerCallback = new MediaControllerCompat.Callback() {
        @Override
        public void onPlaybackStateChanged(@NonNull PlaybackStateCompat state) {
            updatePlaybackState(state);
        }

        @Override
        public void onMetadataChanged(MediaMetadataCompat metadata) {
            if (metadata != null) {
                updateMediaDescription(metadata.getDescription());
                updateDuration(metadata);
            }
        }
    };
</code></pre>

<p>This is the <code>OnSeekBarChangeListener</code></p>

<pre><code>trackSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                trackDurationTextView.setText(DateUtils.formatElapsedTime(progress / 1000));
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                stopSeekbarUpdate();
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                //TODO: look here! the seek bar position is not kept when the user slides it!
                mediaController.getTransportControls().seekTo(seekBar.getProgress());
                scheduleSeekBarUpdate();
            }
        });


 private void updateProgress() {
        if (mLastPlaybackState == null) {
            return;
        }
        long currentPosition = mLastPlaybackState.getPosition();
        if (mLastPlaybackState.getState() != PlaybackStateCompat.STATE_PAUSED) {
            // Calculate the elapsed time between the last position update and now and unless
            // paused, we can assume (delta * speed) + current position is approximately the
            // latest position. This ensure that we do not repeatedly call the getPlaybackState()
            // on MediaControllerCompat.
            long timeDelta = SystemClock.elapsedRealtime() -
                    mLastPlaybackState.getLastPositionUpdateTime();

            currentPosition += (int) timeDelta * mLastPlaybackState.getPlaybackSpeed();
        }
        trackSeekBar.setProgress((int) currentPosition);
    }
</code></pre>

<p>This is the place where mLastPlayBackState.getPosition should return the new value after the seek bar is updated, but it always returns 0 since the onPlaybackStateChanged never gets called. Any ideas why?</p>