¡@

Home 

2014/10/16 ¤W¤È 08:19:29

android Programming Glossary: mlastlocationmillis

Location servise GPS Force closed

http://stackoverflow.com/questions/19365035/location-servise-gps-force-closed

boolean canGetLocation false Location location location double latitude latitude double longitude longitude long mLastLocationMillis private boolean logLocationChanges Declaring a Location Manager protected LocationManager locationManager removed again.. @Override public void onLocationChanged Location location if location null return this.location location mLastLocationMillis SystemClock.elapsedRealtime canGetLocation true if isGPSFix if locationUpdateListeners null for LocationUpdateListener.. int event switch event case GpsStatus.GPS_EVENT_SATELLITE_STATUS isGPSFix SystemClock.elapsedRealtime mLastLocationMillis 3000 if isGPSFix wasGPSFix only notify on changes wasGPSFix isGPSFix for FirstFixListener listener firstFixListeners ..

How can I check the current status of the GPS receiver?

http://stackoverflow.com/questions/2021176/how-can-i-check-the-current-status-of-the-gps-receiver

switch event case GpsStatus.GPS_EVENT_SATELLITE_STATUS if mLastLocation null isGPSFix SystemClock.elapsedRealtime mLastLocationMillis 3000 if isGPSFix A fix has been acquired. Do something. else The fix has been lost. Do something. break case GpsStatus.GPS_EVENT_FIRST_FIX.. you should add the following @Override public void onLocationChanged Location location if location null return mLastLocationMillis SystemClock.elapsedRealtime Do something. mLastLocation location And that's it. Basically this is the line that does it.. mLastLocation location And that's it. Basically this is the line that does it all isGPSFix SystemClock.elapsedRealtime mLastLocationMillis 3000 You can tweak the milliseconds value of course but I would suggest to set it around 3 5 seconds. This actually works..