get Flight Mode - Android Phone

Android examples for Phone:Airplane Mode

Description

get Flight Mode

Demo Code


//package com.java2s;

import android.content.ContentResolver;
import android.content.Context;

import android.provider.Settings;

public class Main {

    public static boolean getFlightMode(Context context) {
        boolean isOpen = false;
        ContentResolver resolver = context.getContentResolver();
        if (Settings.System.getString(resolver,
                Settings.System.AIRPLANE_MODE_ON).equals("0")) {
            isOpen = false;/*from   w w  w . ja  v  a2 s  . co  m*/
        } else {
            isOpen = true;
        }
        return isOpen;
    }
}

Related Tutorials