search

Home  >  Q&A  >  body text

Android怎么判断设备是否静音

我在开发一款应用,需要播放声音和用户交互,但是很多时候用户的手机是静音状态的。
Android有没有接口,可以判断他现在是不是处在静音状态,然后我可以弹出一个提示
他点击一个按钮,就把声音开启

PHPzPHPz2836 days ago1069

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-17 11:06:02

    Mute means the volume is 0. Use AudioManager to get the current volume and determine whether it is 0.

    But there are many types of volume in the Android system: STREAM_VOICE_CALL, STREAM_SYSTEM, STREAM_RING, STREAM_MUSIC, STREAM_ALARM

    I think all you need is to check the media volume STREAM_MUSIC

    Official documentation: http://developer.android.com/referenc...

    reply
    0
  • Cancelreply