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

Apps intent filter to know when user change the volume

cyberneo

Lurker
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.
 
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 !
 
Back
Top Bottom