Example usage for android.content Context getContentResolver

List of usage examples for android.content Context getContentResolver

Introduction

In this page you can find the example usage for android.content Context getContentResolver.

Prototype

public abstract ContentResolver getContentResolver();

Source Link

Document

Return a ContentResolver instance for your application's package.

Usage

From source file:Main.java

@SuppressWarnings("deprecation")
private static boolean isAirplaneModeOnLow(Context context) {
    return Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0;
}

From source file:Main.java

public static String getDeviceUniqueID(Context context) {
    return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
}

From source file:Main.java

public static boolean isDeviceDebugMode(Context context) {
    return Settings.Secure.getInt(context.getContentResolver(), Settings.Global.ADB_ENABLED, 0) != 0;
}

From source file:Main.java

public static String getApn(Context context) {
    Cursor c = context.getContentResolver().query(PREFERRED_APN_URI, null, null, null, null);
    c.moveToFirst();/*from w ww.  j  a  v a  2s.  co m*/
    if (c.isAfterLast()) {
        c.close();
        return null;
    }

    String strResult = c.getString(c.getColumnIndex(APN_PROP_APN));
    c.close();
    return strResult;
}

From source file:Main.java

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

}

From source file:Main.java

public static String getAndroidID(Context cxt) {
    String androidID = Secure.getString(cxt.getContentResolver(), Secure.ANDROID_ID);
    return androidID;
}

From source file:Main.java

public static int getScreenBrightnessModeState(Context context) {
    return Settings.System.getInt(context.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,
            Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
}

From source file:Main.java

/**
 * Gets device's Android ID./* w  w w  .  j  a v a  2s . com*/
 * @since   0.1.0
 * @param   aContext The context from which the ContentResolver is retrieved to read the Android ID.
 * @return   The Android ID.
 */
public static String getAndroidId(Context aContext) {
    return Secure.getString(aContext.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
}

From source file:Main.java

public static int getMediaVolume(Context context) {
    return Settings.System.getInt(context.getContentResolver(), "volume_music", 0);
    //            Settings.System.VOLUME_MUSIC, 0);
}

From source file:Main.java

public static String query(Context context, Uri uri) {
    Cursor cursor = context.getContentResolver().query(uri, new String[] { ImageColumns.DATA }, null, null,
            null);// ww w  . jav  a  2 s.  c  om
    cursor.moveToNext();
    return cursor.getString(cursor.getColumnIndex(ImageColumns.DATA));
}