简体   繁体   中英

j2ME setLocationListener()

I'm programming a GPS tracking system using the Motorola i335 running on Sprint's IDEN network. I'm using the javax.microedition.location api to find the GPS coordinates. To set up the updating, you use the [setLocationListener][1] method. I originally tried passing (listener,2,1,1). However there were too many invalid locations being received (where the GPS could not get the fix in the specified time), so I changed the parameters to (listener, 20, 20, 1). Now the system barely throws any invalid locations. My goal is to get the fastest number of updates that are realistic. Have any of you found a happy medium for parameters of this method?

[1]: http://www-users.cs.umn.edu/~czhou/docs/jsr179/lapi/javax/microedition/location/LocationProvider.html#setLocationListener(javax.microedition.location.LocationListener , int, int, int)

I'd rather implement a verisimilitude check to avoid invalid location data. Checking the provider state for availability and comparing the last returned lat/lon values should do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM