开发者

Problem: While stationary Android GPS gives different location updates - Closed

I am working on an Android Application where I am trying to track movement of the device from a service. The service registers itself for the location updates, here we are making sure that we are asking for "GPS Provider" and not a network provider (开发者_运维技巧which can be inaccurate.)

While calling

public void requestLocationUpdates (String provider, long minTime, float minDistance, LocationListener listener)

provider is "gps"

and minTime and minDistance are both set zero to get best possible results.

Yet when the device is stationary lying on the desk it gets GPS updates which are different from each other so much so that we actually get an average speed (measured by dividing distance by time interval between location updates) more than 5 miles/hr averaged on last 5 location updates.

This totally wrecks the application logic. What can be the reason for the android device (EVO 4, HTC MyTouch) to give different location updates while being completely stationary? Can anybody suggest a way to weed out these wrong location update from the correct ones?

Will appreciate your feedback greatly.

Thanks.

Pritam.

Update:

Finally ended up monitoring the GPS input for 30 seconds for regularity of updates, and stable average speed and time difference between the GPS updates.


The answer is simple: change your application logic.

GPS is not perfect. Signal attenuation and reflections (amongst other things) in urban or indoors environment will cause more inaccuracies including the jumping around motion that you are experiencing. A robust application must learn to deal with this.

You could try to write a filter to essentially average the previous location results to smooth the output, but don't expect perfection.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜