叮当猫咪
通过扩展Alex的答案以包括SDK版本检查,我们可以:/** * Gets the state of Airplane Mode. * * @param context * @return true if enabled. */@SuppressWarnings("deprecation")@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)public static boolean isAirplaneModeOn(Context context) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { return Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0; } else { return Settings.Global.getInt(context.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0) != 0; } }