I'm testing my application in some devices, and i' ve notice that the follow code, does not work for all:
B4X:
...
wLevelAudio = mAudioRecorder.AudioMaxAmplitude / 2700
If wLevelAudio > 2.5 Then
mVolumeOk = False
Else
mVolumeOk = True
End If
...
In my device (HTC ONE S) the threshold of 2.5 is acceptable, while on other devices that i tested (eg. HTC wildfire, Galaxy Nexus), the threshold seems to be too low while testing at the same time with my.
my goal is to give a warning if the volume of environment is too high
You could perhaps play a sound from the device whilst monitoring the volume and provide a method, maybe visual feedback and a slider, to alter the divisor until a target is reached.
I'm not sure that the Maximum value of AudioMaxAmplitude" will vary by phone, just the way it is reported. So the same volume could produce different values on different phones depending on the hardware. It's something you'll need to test.