开发者

howto receive media volume change notifications?

开发者 https://www.devze.com 2023-02-06 05:47 出处:网络
I开发者_如何学Pythons it possible to register a BroadcastReceiver or something to get notifications of media player volume changes?

I开发者_如何学Pythons it possible to register a BroadcastReceiver or something to get notifications of media player volume changes?

Thanks


Immediate value you can get if you use AudioManager

AudioManager mAudioManager = Context.getSystemService(Context.AUDIO_SERVICE);
mAudioManager.getStreamVolume(STREAM_MUSIC);

The only function that gives you opportunity to register broadcast receiver is

mAudioManager.registerMediaButtonEventReceiver(audioBroadcastReceiver);

where audioBroadcastReceiver extends BroadcastReceiver and must be declared in the application manifest.

Not sure if this is exactly what you were looking for.

0

精彩评论

暂无评论...
验证码 换一张
取 消