开发者

Android: Frequency of location updates from location manager

开发者 https://www.devze.com 2023-02-10 13:01 出处:网络
Apologies if this is a very mundane or simple issue. I wrote a location listener class for my开发者_运维知识库 android device and set the requestupdate as follows:

Apologies if this is a very mundane or simple issue.

I wrote a location listener class for my开发者_运维知识库 android device and set the requestupdate as follows:

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);

I see the GPS icon come up, blink and then hold steady. In my log, I see location updates, but the problem is there are very few updates, maybe once in 30 seconds or once a minute sometimes (while driving in my car).

Is this normal? Is there any way to get a higher frequency?


Well, as far as i know it depends on the phone, signal and the accuracy that you request...

Criteria locationCriteria = new Criteria();
locationCriteria.setAccuracy(Criteria.ACCURACY_FINE);

lm.requestLocationUpdates(lm.getBestProvider(locationCriteria, true), 0, 0, currentLocationListener);

Here's the code i used, it worked pretty fast on my phone.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号