on-internet
← Community

audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) returns 0

Stack Overflow ·

I am making an Speaking caller name application which pause the ringtone before speaking the caller name using TextToSpeech. I am detecting the current Volume using int musicVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC); Mostly this returns 0 but sometimes 15 the correct value. The phone is in normal mode and the volume of phone is full. I need this value to correctly speak the caller name but this unpredictable behaviour is making me crazy. What wrong am i doing? Isn't this the correct way to detect ringtone volume?

Comments

Sign in or sign up to comment and upvote.

No comments yet.