Android: LocationManager.requestLocationUpdates doesn't respect params

笑着哭i 提交于 2019-12-12 02:42:33

问题


I have a problem recieving notifications from LocationManager after a set period of time:

    locationManager = (LocationManager)getSystemService(LOCATION_SERVICE);
    if(useGPS) {
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 999999, 
                999999, locationListener);

In emulator my location listener's onLocationChanged method gets called whenever I send a fix via emulator control (i.e. every other second) So, the question is - is this because the way I'm testing on emulator, or LocationManager doesn't respect params?

Thanks


回答1:


The doc says:

minTime - the minimum time interval for notifications, in milliseconds. This field is only used as a hint to conserve power, and actual time between location updates may be greater or lesser than this value.



来源:https://stackoverflow.com/questions/4418018/android-locationmanager-requestlocationupdates-doesnt-respect-params

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!