Added getLastKnownLocation method to LocationLoggingService.

This commit is contained in:
Filip Strajnar 2024-10-27 13:22:03 +01:00
parent 231d2fc835
commit 32a4467bce

View file

@ -114,6 +114,12 @@ public class LocationLoggingService extends Service implements 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
public void onDestroy() {
Log.d(TAG, "Service has been destroyed.");