在Android KitKat 4.4中有一种节省电池的模式。它将优化GPS和其他功能,以节省电池寿命。是否可以检查手机是否处于节电模式?
发布于 2014-01-06 10:24:29
下面应该有帮助,请注意,这仅在API级别的19+上可用:
private void checkLocationModeSettings() {
int mode = Settings.Secure.getInt(getContentResolver(), Settings.Secure.LOCATION_MODE,
Settings.Secure.LOCATION_MODE_OFF);
switch (mode) {
case Settings.Secure.LOCATION_MODE_SENSORS_ONLY:
Log.d(TAG, "Sensor only mode");
break;
case Settings.Secure.LOCATION_MODE_BATTERY_SAVING:
Log.d(TAG, "Battery saving mode");
break;
case Settings.Secure.LOCATION_MODE_HIGH_ACCURACY:
Log.d(TAG, "High accuracy mode");
break;
case Settings.Secure.LOCATION_MODE_OFF:
default:
Log.d(TAG, "Location access is disabled");
}
}https://stackoverflow.com/questions/20946876
复制相似问题