I am writing an app that basically just tests if we can get anything at all from the microphone.
It works perfectly on several android devices, but not on the LG Optimus. Everytime I call MediaRecorder.getMaxAmplitude on the LG it returns 0.
The device is successfully recording, because I can listen to the recordings.
getMaxAmplitude returns the maximum amplitude since the last time you called it.
So, the first time you call it, it initializes itself (and so returns 0) the second time, it should return another value. According to the documentation :
Or, if you use it right, you have the same problem as I have. My code works on a galaxyTab 7(Froyo), but not 10.1 (Honeycomb).
EDIT : I repaired my problem (I hope it’ll help you too). Make sure the first time you call getMaxAmplitude, in order to initialize it, you called start() first.
I used:
When it should have been :
EDIT : This code still has flaws it seems. This code doesn’t seems to work on S2, for instance. It’ll return 0. But I call getMaxAmplitude() only twice, so if you need to update the amplitude every second for example, it may be ok.