android Programming Glossary: bestlocation
Good way of getting the user's location in Android http://stackoverflow.com/questions/6181704/good-way-of-getting-the-users-location-in-android LocationManager.NETWORK_PROVIDER if getLocationQuality bestLocation LocationQuality.GOOD Looper.prepare setLooper Looper.myLooper.. updateBestLocation location if getLocationQuality bestLocation LocationQuality.GOOD return We're done Looper l getLooper.. locationListener setLooper null if getLocationQuality bestLocation LocationQuality.BAD sendUpdate locationToString bestLocation..
Good way of getting the user's location in Android http://stackoverflow.com/questions/6181704/good-way-of-getting-the-users-location-in-android updateBestLocation locationManager .getLastKnownLocation LocationManager.NETWORK_PROVIDER if getLocationQuality bestLocation LocationQuality.GOOD Looper.prepare setLooper Looper.myLooper Define a listener that responds to location updates LocationListener.. LocationListener public void onLocationChanged Location location updateBestLocation location if getLocationQuality bestLocation LocationQuality.GOOD return We're done Looper l getLooper if l null l.quit public void onProviderEnabled String provider.. Looper.loop t.cancel locationManager.removeUpdates locationListener setLooper null if getLocationQuality bestLocation LocationQuality.BAD sendUpdate locationToString bestLocation else Log.w LocationCollector Failed to get a location private..
|