Search code examples
androidandroid-management-api

Volume is muted when adjustVolumeDisabled is set to true


There is a device running in kiosk mode with single app. It is required, that adjusting volume should be disabled, so I'm using "adjustVolumeDisabled": true in the policy. However, setting it to true mutes volume and I am unable to change it programmatically, so this does nothing:

(getSystemService(Context.AUDIO_SERVICE) as AudioManager)
            .adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, 0)

And AudioManager.getStreamVolume(AudioManager.STREAM_MUSIC) always returns max value, while I can't hear any sound.

What I'm trying to achieve is playing video with sound using ExoPlayer. Is there any way to forbid adjusting volume, but set it to max value instead of muting?


Solution

  • This is working as intended, although the documentation need to be updated to reflect that.

    Setting adjustVolumeDisabled to false on a fixed volume device could potentially help with your query: https://developer.android.com/guide/topics/media-apps/volume-and-earphones#fixed-volume