I'm trying to set up a quick and dirty GPS lookup via LocationManager
which fetches a network location (within 500 meters) every half second
for ten seconds. In other words, I'm just trying to find the correct
coarse Criteria settings and the correct logic to stop checking after
10 seconds of no better locations within my Handler thread.
I'm thinking my main loop should look something like this:
/**
* Iteration step time.
*/
private static final int ITERATION_TIMEOUT_STEP = 500;
public void run(){
boolean stop = false;
counts++;
if(DEBUG){
Log.d(TAG, "counts=" + counts);
}
//if timeout (11 secs) exceeded, stop tying
if(counts > 22){
stop = true;
}
//location from my listener
if(bestLocation != null){
//remove all network and handler callbacks
} else {
if(!stop){
handler.postDelayed(this, ITERATION_TIMEOUT_STEP); //
half-sec intervals
} else {
//remove callbacks
}
}
}
What I want to know is after I fetch the last known location as my
initial best location and kick off my thread, how do I set up the
coarse criteria so that I receive a more accurate one than the initial
one (in order to compare the two), which is diametrically different
from my current location?
--
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