Search code examples
androidandroid-audiomanager

Why AudioManager.isStreamMuted isn't available?


I'm using android AudioManager to mute and unmute streams like STREAM_SYSTEM and STREAM_NOTIFICATION, muting is straightforward calling setStreamMute but I'm unable to find an isStreamMuted method.

Looking inside source code I can see it exists so the question is 'how can check if a stream is muted?

I'm working on Android 4.0.4


Solution

  • The unpleasant answer is that stream mute operates on a per-process basis. So you can safely store the mute state in a static variable somewhere, appropriately wrapped, and track mute state yourself. Speaking from bitter experience. Sometimes you do what you have to do. Why did they do that? That's a more difficult question....