PPS*_*ein 1 android geolocation locationmanager
在android位置管理器中,我们应该提供更新的最小距离更改和更新之间的最短时间.因此,我需要知道我应该提供多长时间的最小距离范围和最短时间,以便尽快知道当前位置?
Sho*_*uri 11
尽管将两个值都设置为0会使您速度最快但会消耗大量资源,因此会浪费大量电池电量.为了选择合适的值,您必须首先看到您的需求,如文档所示:
The location update interval can be controlled using the minTime parameter. The elapsed time between location updates will never be less than minTime, although it can be more depending on the Location Provider implementation and the update interval requested by other applications.
此外,函数文档requestLocationUpdate建议选择您的值如下:
它说:
Choosing a sensible value for minTime is important to conserve battery life. Each location update requires power from GPS, WIFI, Cell and other radios. Select a minTime value as high as possible while still providing a reasonable user experience.
再具体一点:
If your application is not in the foreground and showing location to the user then your application should avoid using an active provider (such as NETWORK_PROVIDER or GPS_PROVIDER), but if you insist then select a minTime of 5*60*1000(5分钟) or greater. If your application is in the 前景 and showing location to the user then it is appropriate to select a 更快的更新间隔.
作为minDistance参数:
If it is greater than 0 then the location provider will only send your application an update when the location has changed by at least minDistance meters, AND at least minTime milliseconds have passed. 但是,位置提供商使用minDistance参数更难以节省功耗,因此minTime应该是节省电池寿命的主要工具.
希望这可以帮助.
| 归档时间: |
|
| 查看次数: |
3939 次 |
| 最近记录: |