0

Ive been playing around with the android RemoteController class and while it works flawlessly with Google Play Music I've been having some issues with it on other players such as pandora.

Pandora is currently my focus. I've been able to send it a pause and skip commands however after I send it a pause command pandora will no longer respond to the following play command or skip song command. Currently I've been working with Dr. Breens example on git hub.

https://github.com/DrBreen/RemoteControllerExample/blob/master/src/com/woodblockwithoutco/remotecontrollerexample/RemoteControlService.java

So I'm wondering if there is another way to go about this so that Pandora starts playing again that wasn't covered in his example?

4

1 回答 1

0

I turns out making assumptions is a good thing here. Pandora stops sending play state updates after it has been paused. I fixed this by changing the on click listener it should be:

private OnClickListener mClickListener = new OnClickListener() {

    @Override
    public void onClick(View v) {
        switch(v.getId()) {
        case R.id.prev_button:
            if(mBound) {
                mRCService.sendPreviousKey();
            }
            break;
        case R.id.next_button:
            if(mBound) {
                mRCService.sendNextKey();
            }
            break;
        case R.id.play_pause_button:
            if(mBound) {
                if(mIsPlaying) {
                    mRCService.sendPauseKey();
                    mIsPlaying = false;
                } else {
                    mRCService.sendPlayKey();
                    mIsPlaying = true;
                }
            }
            break;
        }
    }
};
于 2014-07-30T18:02:01.400 回答