try usin the time tick event instead of systime... u cud keep track of the
time ticks elapsed...
since u said couple of minutes:

"
I'm trying to check the age of a GPS fix, so that I can discard
location fixes that are more than, say, a couple of minutes old - I
need my fix to be very accurate.
"
have a look at this:
http://developer.android.com/reference/android/content/Intent.html#ACTION_TIME_TICK


this is jus a round abt method...

hope it helps.
cheers!


On Tue, Jul 21, 2009 at 3:52 PM, Anna PS <[email protected]>wrote:

>
> Hi all
>
> Just updating this thread, which seems to be too old for me to post a
> follow-up:
> http://groups.google.com/group/android-developers/browse_thread/thread/df1e14fe4e9ad896/
>
> I'm trying to check the age of a GPS fix, so that I can discard
> location fixes that are more than, say, a couple of minutes old - I
> need my fix to be very accurate. This is the code I use:
>
>                        long locationTime = location.getTime();
>                        long currentTime = System.currentTimeMillis
> ();
>                        timeDifference = (currentTime -
> locationTime) / 1000;
>                        if (timeDifference > 120) {
>                          // warn the user
>                        }
>
> However, this method is entirely dependent on the user having set
> their system time correctly. If they are just a few minutes out (and
> lots of people do like to keep their clocks a few minutes fast) then
> they will only ever get warned.
>
> I don't know what to do - I can't accept location data that's
> potentially out of date, nor can I rely on my users to have correct
> system time within a couple of minutes. The problem is that there is
> no way to check the age of the GPS data itself, just the time
> (location.getTime() returns the UTC time, rather than the the age, of
> the data).
>
> Is there any way around this? I guess I could check the locationTime a
> few times in succession and see if it changes, and assume that if it
> changes then it must be getting updated, but it feels kind of fiddly.
>
> Thanks
> Anna
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to