Pregunta

In my Android application, I would like to save the current speaker/mic volume level so that I can set it to the same level next time the application is run. I am wondering if there is any API to get/set speaker/mic volume levels.

¿Fue útil?

Solución

AudioManager seems to do what you need for the speaker volume. You can use the getStreamVolume method in conjuction with one of the STREAM_X constants to get the volume you need and store it with SharedPreferences.

To set it afterwards, use the setStreamVolume method with the correct constant.

Otros consejos

You can use SharedPreferences for this task. Standard documentation has lots of information about it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top