Android KitKat 4.4 中有一种省电模式。它将优化 GPS 和其他功能以节省电池寿命。是否可以检查手机是否处于省电模式?
问问题
1798 次
1 回答
1
以下应该会有所帮助,请注意,这仅适用于 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");
}
}
于 2014-01-06T10:24:29.847 回答