Dev/Android
Android 날짜 및 시간 자동 설정 체크 - Automatic date and time check
healthyryu
2018. 1. 17. 10:30
날짜 및 시간 자동 설정 체크
public static boolean isTimeAutomatic(Context c) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return Settings.Global.getInt(c.getContentResolver(), Settings.Global.AUTO_TIME, 0) == 1;
} else {
return android.provider.Settings.System.getInt(c.getContentResolver(), android.provider.Settings.System.AUTO_TIME, 0) == 1;
}
}
젤리빈 이전에는 Settings 의 System 클래스에서 세팅값 정보를 가져왔습니다만 deprecate 되고
젤리빈 이후에는 Global 클래스로 옮겨가서 Global 에서 Setting 값 정보를 얻어오도록 바뀌었습니다.
반응형