Java tutorial
//package com.java2s; import android.annotation.SuppressLint; import android.content.Context; import android.os.Build; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; public class Main { @SuppressLint("NewApi") @SuppressWarnings("deprecation") public static boolean isAModeEnabled(Context context) { int state = 0; try { if (isJBean()) state = Settings.System.getInt(context.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON); else state = Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON); } catch (SettingNotFoundException e) { e.printStackTrace(); } if (state == 0) return false; return true; } public static boolean isJBean() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) return true; return false; } }