gpt4 book ai didi

android - 为什么 `PRIORITY_BALANCED_POWER_ACCURACY` 比 `PRIORITY_HIGH_ACCURACY` 消耗更多电池?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:13:40 26 4
gpt4 key购买 nike

我们对同一情况下仅连接到 WiFi 的设备每 10 分钟请求位置所消耗的电池电量进行了基准测试

  • 恢复出厂设置
  • 相同的起始电池电量
  • 没有安装额外的应用

首先将优先级设置为 PRIORITY_BALANCED_POWER_ACCURACY,然后设置为 PRIORITY_HIGH_ACCURACY

令人惊讶的是,前者与后者耗电量相同,甚至更多。这是电池使用情况的图表:

有人可以解释一下这种行为吗?

最佳答案

PRIORITY_HIGH_ACCURACY 更有可能使用 GPS,PRIORITY_BALANCED_POWER_ACCURACY 更有可能使用 WIFI 和手机信号塔定位。

  • PRIORITY_BALANCED_POWER_ACCURACY(~100 米“方 block ”精度)
  • PRIORITY_HIGH_ACCURACY(以电池生命周期为代价尽可能准确)

    使用setInterval(long)setFastestInterval(long) 来节省电池生命周期。

Example:

private static final long INTERVAL = 60 * 1000;
private static final long FASTEST_INTERVAL = 5 * 1000;
private static final long DISPLACEMENT = 100;

private LocationRequest createLocationRequest(){
LocationRequest mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(INTERVAL);
mLocationRequest.setFastestInterval(FASTEST_INTERVAL);
mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
mLocationRequest.setSmallestDisplacement(DISPLACEMENT);
return mLocationRequest;
}

Google 在此处描述了 LocationRequest 类:http://developer.android.com/reference/com/google/android/gms/location/LocationRequest.html

关于android - 为什么 `PRIORITY_BALANCED_POWER_ACCURACY` 比 `PRIORITY_HIGH_ACCURACY` 消耗更多电池?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31119580/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com