Added getLastKnownLocation method to LocationLoggingService.
This commit is contained in:
parent
231d2fc835
commit
32a4467bce
|
|
@ -114,6 +114,12 @@ public class LocationLoggingService extends Service implements LocationListener
|
||||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
|
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
|
public Location getLastKnownLocation(){
|
||||||
|
LocationManager locationManager = (LocationManager) getSystemService(Service.LOCATION_SERVICE);
|
||||||
|
return locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
Log.d(TAG, "Service has been destroyed.");
|
Log.d(TAG, "Service has been destroyed.");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue