Android Code Snippet Checking device volume in Android

Using GetVolume() returns your device volume value, but the scale may vary due to your device model. Scaling this value in the range of (0 to 1) may be like this:
B4X: Copy
Public Sub GetVolumeScaled() As Float '0 to 1
    Dim myPhone As Phone
    Return myPhone.GetVolume(myPhone.VOLUME_MUSIC) / myPhone.GetMaxVolume(myPhone.VOLUME_MUSIC)
End Sub
 

Similar Threads

Back
Top