Forcing volume control to be for the Media volume in my app

by John Lussmyer » Tue, 28 Dec 2010 01:44:18 GMT


Sponsored Links
 My app plays very short sounds frequently.
I'd like the user to be able to use their normal volume controls to turn the
volume up or down.
The problem is that while my app is running, the volume control defaults to
the Ringer volume, and only adjusts the Media volume if the user happens to
press the button while one of my beeps or clicks is playing.
How can I tell Android that while my app is active, the volume controls
should default to adjusting the Media volume?

-- 



Re: Forcing volume control to be for the Media volume in my app

by Mark Murphy » Tue, 28 Dec 2010 01:49:34 GMT


 


In the affected activity, call setVolumeControlStream().

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 


Sponsored Links


Re: Forcing volume control to be for the Media volume in my app

by John Lussmyer » Tue, 28 Dec 2010 02:11:25 GMT


 Thanks.  Using:
        setVolumeControlStream(AudioManager.STREAM_MUSIC);
did the trick.
(Sure would be nice if the setVolumeControlStream() docs actually told you
what the valid values are, or at least where to find them.)





-- 



Other Threads

1. Epic 4G, Galaxy Tab, and Transform Updates for Sprint

kirain GB for Epic hehehe

2011/3/18 Wen Wen Handriputra <wendro...@gmail.com>




-- 
Rgds,

Petra Immanuel

-- 
===============

2. Interface Inconsistency

I'm not entirely certain whether it's android or HTC Sense but one
thing I find that is wrong with my android phone is that to dismiss a
call I have to flick the screen upwards.  However to dismiss an
Outlook calendar event I have to flick it downwards.

Only a minor niggle but when multitasking I find it a distraction!

-- 
.

3. Voice SMS

4. Color Picker Preference

5. Article Not Listed in "Articles" Menu

6. Android 3.0 presentation on Slideshare

7. emulator running abnormally slow