Getting the status of flight mode in Android

The following code snippet can be used to get the status of flight mode in Android:

import android.provider.Settings;
import android.content.Context;

class Utils {
    public static boolean isAirplaneModeOn(final Context context) {
        return Settings.System.getInt(context.getContentResolver(),
            Settings.System.AIRPLANE_MODE_ON, 0) != 0;
    }
}

Comments