• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Setting Alarm Volume

Sycobob

Well-Known Member
I'm writing a small application and having a bit of trouble setting the alarm volume. I've tried a couple of different methods, but neither actually seem to change the alarm volume.

My goal, is to mute all alarms under certain conditions. I have no issue checking the conditions, just actually changing the volume. I'm currently using the AudioManager class to make the changes (as suggested in the Android Developers website). I tried

setStreamVolume(int streamType, int index, int flags)

using STREAM_ALARM for the streamType. Using FLAG_SHOW_UI, it displays a toast showing that the volume was set properly, but if and alarm goes off, it still plays at full volume.

I also tried

setStreamMute(int streamType, boolean state)

but again, the alarms go off as if nothing changed. Can anyone point me in the correct direction, please?

EDIT: I tested the same method with the media volume and it works perfectly. This leads me to believe the setting is being applied just as it should, but alarms simply aren't obeying the setting. This may have something to do with the fact that each alarm has it's own volume control. Still trying to find a way to mute them.
 
Back
Top Bottom