Get the device volume
Members - Reputation: 481
Posted 25 September 2012 - 01:57 PM
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?
Moderators - Reputation: 33273
Posted 25 September 2012 - 02:09 PM
That will raise and lower the volume by one increment, and it will operate correctly if the device has weird audio streams.
Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.
Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.