Java Code Examples for android.media.AudioManager#isMicrophoneMute()

The following examples show how to use android.media.AudioManager#isMicrophoneMute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioManagerUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 判断麦克风是否静音
 * @return {@code true} yes, {@code false} no
 */
public static boolean isMicrophoneMute() {
    AudioManager audioManager = AppUtils.getAudioManager();
    if (audioManager != null) {
        try {
            return audioManager.isMicrophoneMute();
        } catch (Exception e) {
            LogPrintUtils.eTag(TAG, e, "isMicrophoneMute");
        }
    }
    return false;
}
 
Example 2
Source File: MediaUtils.java    From q-municate-android with Apache License 2.0 4 votes vote down vote up
public static boolean isMicrophoneMuted(Activity activity) {
    AudioManager audioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
    return audioManager.isMicrophoneMute();
}