GetLastKnownLocation
Overview
GetLastKownLocation API provides the last known location. On Android, the method returns a Location object. However, it requires at least one running service otherwise it will return a null object.
Example
@Override
public void onGetLastLocationBtnPressed (View view) {
Location location = NAOServicesConfig.getLastKnownLocation();
if(location == null ||
(location.getTime() == 0 && location.getLatitude() == 0
&& location.getLongitude() == 0 && location.getAltitude() == 0
&& location.getAccuracy() == 0)) {
Log.d(getClass().getSimpleName(), "/*dbg*/" + "Last Known location is not available");
} else {
Log.d(getClass().getSimpleName(), "/*dbg*/" + location.getLatitude()
+ "," + location.getLongitude() + "," + location.getAltitude()
+ "," + location.getAccuracy() + "," + location.getBearing());
}
}