Jump to content
  • Advertisement
Sign in to follow this  
sheep19

Get the device volume

This topic is 2118 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I will explain my situation briefly:

Let's say I'm on my android phone and I set the volume to 0 (silent).
Then I start my application. Inside my app, I start playing music (using MediaPlayer).
I don't want the music to start playing - but it does, even though the phone is silenced. I'm not saying that's wrong.

So what I want to do is to "get" the volume of the device (it would have to be 0 or 0.0 in this case) and set it using: audioManager.setStreamVolume().

How can I get that information?

Share this post


Link to post
Share on other sites
Advertisement
I'd try adjustSuggestedStreamVolume instead.

That will raise and lower the volume by one increment, and it will operate correctly if the device has weird audio streams.

Share this post


Link to post
Share on other sites
Just an FYI, android maintains 3 seperate volume levels. Ringer volume (which is what the silent mode refers to), Media volume (which I think is the only one apps can play with directly) and In call volume.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!