0

我们如何知道当前的安卓手机声音配置文件?我的意思是设备是否处于静音/会议等状态...

我们可以将设备当前配置文件状态发送给其他人吗?

4

1 回答 1

4
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);

switch (am.getRingerMode()) {
    case AudioManager.RINGER_MODE_SILENT:
        Log.i("MyApp","Silent mode");
        break;
    case AudioManager.RINGER_MODE_VIBRATE:
        Log.i("MyApp","Vibrate mode");
        break;
    case AudioManager.RINGER_MODE_NORMAL:
        Log.i("MyApp","Normal mode");
        break;
}


private static boolean isAirplaneModeOn(Context context) {

   return Settings.System.getInt(context.getContentResolver(),
           Settings.System.AIRPLANE_MODE_ON, 0) != 0;

}
于 2013-07-11T06:21:35.770 回答