Android 6.0 默认关闭定位和GPS,开启后默认选省电
默认关闭定位和GPS 修改位置
frameworks/base/packages/SettingsProvider/res/values/defaults.xml
<string name="def_location_providers_allowed" translatable="false">network,gps</string>
修改为
<string name="def_location_providers_allowed" translatable="false"></string>
默认省电 修改位置
com/android/settings/location/LocationSettings.java
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。public class LocationSettings extends LocationSettingsBase
@Override
public void onSwitchChanged(Switch switchView, boolean isChecked) {
if (isChecked) {
//setLocationMode(android.provider.Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
setLocationMode(android.provider.Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
} else {
setLocationMode(android.provider.Settings.Secure.LOCATION_MODE_OFF);
}

更多精彩