List of usage examples for android.content Context getContentResolver
public abstract ContentResolver getContentResolver();
From source file:Main.java
public static String getUniqueDeviceID(Context ctx) { String android_id = Secure.getString(ctx.getContentResolver(), Secure.ANDROID_ID); return android_id; }
From source file:Main.java
public static void askForPermission(final Context context) { final ContentResolver cr = context.getContentResolver(); cr.query(CallLog.Calls.CONTENT_URI, null, null, null, null); }
From source file:Main.java
public static void toggleHapticFeedback(Context mContext) { Settings.System.putInt(mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, !isHapticFback(mContext) ? 1 : 0); }
From source file:Main.java
public static String getPhoneId(Context _context) { String phoneId = Secure.getString(_context.getContentResolver(), Secure.ANDROID_ID); return phoneId; }
From source file:Main.java
public static boolean isAutoAdjustBrightness(Context context) { ContentResolver cr = context.getContentResolver(); try {// w w w .j av a2s .c o m return Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC == Settings.System.getInt(cr, Settings.System.SCREEN_BRIGHTNESS_MODE); } catch (SettingNotFoundException e) { e.printStackTrace(); } return false; }
From source file:Main.java
public static int getBrightness(Context context) { ContentResolver cResolver = context.getContentResolver(); try {// w ww .j a v a2 s. c om return Settings.System.getInt(cResolver, Settings.System.SCREEN_BRIGHTNESS); } catch (Settings.SettingNotFoundException e) { return 0; } }
From source file:Main.java
public static boolean is24H(Context context) { ContentResolver resolver = context.getContentResolver(); String strTimeFormat = android.provider.Settings.System.getString(resolver, android.provider.Settings.System.TIME_12_24); if ("24".equals(strTimeFormat)) { return true; }//from ww w . j a v a2 s. c o m return false; }
From source file:Main.java
/** * Utility method for deleting all the elements from a given content URI. * You have to provide the name of the primary key column. * /*from w w w . j ava 2 s.co m*/ * @param ctx the context whose content resolver to use to lookup the URI * @param contentUri the content URI to delete all the items from * @param idColumn the column of the primary key for the URI */ private static void deleteContentUri(Context ctx, Uri contentUri, String idColumn) { ctx.getContentResolver().delete(contentUri, null, null); }
From source file:Main.java
/** * Retrieve ANDROID_ID.//from ww w . j ava 2 s . c o m * * @param context Context of application * @return This will return unique identifier for device. */ public static String getAndroidId(Context context) { return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); }
From source file:Main.java
public static int get(Context context) { ContentResolver cResolver = context.getContentResolver(); try {// w w w .j a v a 2 s. c o m return Settings.System.getInt(cResolver, Settings.System.SCREEN_BRIGHTNESS); } catch (Settings.SettingNotFoundException e) { return 0; } }