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. Backup and Restore service not working

Hi All,

I am trying out the back up and restore service of Android
Am able to successfully do back up of data and also restore when I
uninstall and then install the application (using bmgr tool).

But when I reflash and try restoring, I am getting error: "Unable to
restore package". I am using the sample application provided by
google.

I have:

a) Registered for B&R service and placed the key in manifest file.
b) Enabled backup and restore option.
c) Connected to gmail (is it needed or just network connectivity is
fine ?).

It would really help if anyone can provide some input on this issue?
Thanks :)

-- 

2. [Closed]: WTB - Nomer Smart yang sudah ada akey dan min untuk di inject ke droid 2 malam ini

Thank you infonya. sekalian saya close thread ini.
Besok coba bawa HH ke galeri smart

2011/3/1 Justinus U Adrianto <jusdroi...@gmail.com>






-- 
*****************************************************
Bayu Seno Adji
Website : http://bayusenoadji.com
Blog : http://catatan.bayusenoadji.com
Web Hosting Murah : http://rnbwebhosting.com
*****************************************************

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

3. Regarding C2DM Registration

4. Try to implement coverflow animation using Gallery

5. Closed WTA service centre LG

6. Aplikasi di Android Spica banyak yg hilang (not found)

7. ada yg pake kartu A*is paket 1GB daerah Sby?