How to check if phone is mute, vibrate or loud in android

后端 未结 2 2109
执念已碎
执念已碎 2020-12-25 12:02

This is my code to mute/unmute phone. But I would like to check if phone is alreay on mute and if is not then i will mute it. If is in vibrate then i will make it normal.

2条回答
  •  情话喂你
    2020-12-25 12:20

    try this:

    switch( audio.getRingerMode() ){
    case AudioManager.RINGER_MODE_NORMAL:
       break;
    case AudioManager.RINGER_MODE_SILENT:
       break;
    case AudioManager.RINGER_MODE_VIBRATE:
       break;
    }
    

提交回复
热议问题