1. Download our Official Android App: Forums for Android!

Apps Setting Alarm Volume

Discussion in 'Android Development' started by Sycobob, Sep 25, 2011.

  1. Sycobob

    Sycobob Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    38
    Posts:
    113
    Joined:
    Aug 7, 2011

    Aug 7, 2011
    113
    22
    38
    Physicist
    Tallahassee, FL
    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.
     

    Advertisement

  2. Sycobob

    Sycobob Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    38
    Posts:
    113
    Joined:
    Aug 7, 2011

    Aug 7, 2011
    113
    22
    38
    Physicist
    Tallahassee, FL

Share This Page

Loading...