Android examples for android.media:AudioManager
Returns true if device ringer is silent or vibrate, otherwise false
import android.content.Context; import android.media.AudioManager; public class Main{ /** Returns true if device ringer is silent or vibrate, otherwise false. */ public static boolean isRingerSilent(Context context) { AudioManager am = (AudioManager) context .getSystemService(Context.AUDIO_SERVICE); int ringerMode = am.getRingerMode(); if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) { return true; }// w w w. j av a 2 s . c om return false; } }