Rustam
Location listener doesn't have timing constraint.
Therefore you need to enable listener as usual and create an
asynchronous thread or a timer or something else to check GPS status
after a certain time.
Below is a simple code which does checks GPS fix after 60 seconds.
Best
Igor
// code fragment starts:
private Handler mHandler = new Handler();
private void Start() {
// invoke mGPScheckTask handler (see below) after 60 seconds
interval
mHandler.postDelayed(mGPScheckTask, 60 * 1000);
}
private void Stop() {
mHandler.removeCallbacks(mGPScheckTask);
}
private Runnable mGPScheckTask = new Runnable() {
public void run() {
if( GPSfix )
// do something
else
// do something else
// remove GPS listener here
};
On Nov 30, 1:07 pm, Rustam Kovhaev <[email protected]> wrote:
> How do I listen for GPS location changes for lets say 5 minutes?
> and if It don't get a single gps fix it removes listener(removeUpdates())
>
> --
> Regards,
> Rustam Kovhaevhttp://libertadtech.com
--
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