Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Get the device volume

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 sheep19   Members   

494
Like
0Likes
Like

Posted 25 September 2012 - 01:57 PM

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?

#2 frob   Moderators   

44029
Like
0Likes
Like

Posted 25 September 2012 - 02:09 PM

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.

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.


#3 6677   Members   

1054
Like
0Likes
Like

Posted 27 September 2012 - 11:51 AM

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.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.