freshollie / monkeyboard-radio-android

Monkeyboard - FM & DAB/DAB+ radio for android
GNU General Public License v3.0
38 stars 18 forks source link

Volume control from head unit #3

Closed thnilsen closed 7 years ago

thnilsen commented 7 years ago

It looks like there's a bug with the handleSetVolumeRequest() function in RadioplayerService.java. The code segments in this function is never executed when using the volume control on the device, so the volume always stays at the default level.

When part of the code in the function is commented out it works as expected.

  public void handleSetVolumeRequest(final int newVolume) {
        //handleAction(
        //        new Runnable() {
        //            @Override
         //           public void run() {
                        volume = newVolume;
                        radio.setVolume(volume);
                        saveVolume();
                    //}
               // }
        //);
    }
freshollie commented 7 years ago

What's the log error?

On 20 Feb 2017, at 22:19, thnilsen notifications@github.com wrote:

It looks like there's a bug with the handleSetVolumeRequest() function in RadioplayerService.java. The code segments in this function is never executed when using the volume control on the device, so the volume always stays at the default level.

When part of the code in the function is commented out it works as expected.

public void handleSetVolumeRequest(final int newVolume) { //handleAction( // new Runnable() { // @Override // public void run() { volume = newVolume; radio.setVolume(volume); Log.d("Volume", String.valueOf(newVolume)); Log.d("Volume new", String.valueOf(volume)); saveVolume(); //} // } //); } — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

thnilsen commented 7 years ago

The two Log.d() lines was just used while troubleshooting the issue to see if the code ever got called.

freshollie commented 7 years ago

Sorry, I read this wrong. Could you explain the issue in a little more detail. Do you mean the volume buttons on the device don't change the volume? I know that handle set volume works on my testing for setting the volume.

thnilsen commented 7 years ago

With the setting "Headunit Controller Input" enabled, the physical volume up/down buttons on the device does not interact with the volume controller in the app. It tries to to reduce/increase the volume, but the saveVolume() function is never triggered.

When testing the latest code on AVD using both 4.x and 5.x devices, they all show the same issue. By commenting out part of the saveVolume() function as seen in the first post it works as expected.

freshollie commented 7 years ago

Just want to update you on this. The volume will only change if the radio is connected. I don't know why this functionality would need to be changed.

freshollie commented 7 years ago

Scratch that, updated this