1. Check out our companion app, Forums for Android! Download from Google Play

intent filter to know when user change the volume

Discussion in 'Application Development' started by cyberneo, Aug 30, 2009.

  1. cyberneo

    cyberneo New Member
    Thread Starter
    5

    Aug 30, 2009
    3
    0
    5
    hello, i want to develop an application who allow the user to change
    the brightness of the screen when he change the volume (in same time
    he can choose volume or brightness in all application). In src of
    class AudioManager i've see this :

    /**
    * @hide Broadcast intent when the volume for a particular stream
    type changes.
    * Includes the stream and the new volume
    *
    * @see #EXTRA_VOLUME_STREAM_TYPE
    * @see #EXTRA_VOLUME_STREAM_VALUE
    */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String VOLUME_CHANGED_ACTION =
    "android.media.VOLUME_CHANGED_ACTION";


    so i create a Broadcast Receiver to capture this event but nothing.

    Anybody know how i can do this ? thanks.
     

    Advertisement

  2. cyberneo

    cyberneo New Member
    Thread Starter
    5

    Aug 30, 2009
    3
    0
    5
    ok i've found that is impossible :

    private void sendVolumeUpdate(int streamType)
    {
    Intent intent = new Intent (AudioManager.VOLUME_CHANGED_ACTION);
    intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, streamType);
    intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, getStreamVolume(streamType));

    // Currently, sending the intent only when the stream is BLUETOOTH_SCO
    if (streamType == AudioManager.STREAM_BLUETOOTH_SCO) {
    mContext.sendBroadcast(intent);
    }
    }

    the intent is not send !
     

Share This Page

Loading...