private void getLocationUpdates() {
TrackerSettings settings =
new TrackerSettings()
.setUseGPS(true)
.setUseNetwork(true)
.setUsePassive(true);
// .setTimeBetweenUpdates(5000);
// .setTimeBetweenUpdates(30 * 60 * 1000)
// .setMetersBetweenUpdates(100);
LocationTracker tracker = new LocationTracker(getApplicationContext(), settings) {
@Override
public void onLocationFound(Location location) {
// Do some stuff
String latlng = location.getLatitude() + ", " + location.getLongitude();
Log.d("WorkManager", "onLocationFound: " + latlng);
}
@Override
public void onTimeout() {
Log.d("WorkManager", "onTimeout: ");
}
};
tracker.startListening();
}
in the doWrok() function of WorkManager.
But this code works in the Service.
I am using this code:
in the doWrok() function of WorkManager.
But this code works in the Service.