Search in sources :

Example 1 with Location

use of org.odk.collect.location.Location in project collect by opendatakit.

the class GeoPolyActivity method startInput.

@Override
public void startInput() {
    inputActive = true;
    if (recordingEnabled && recordingAutomatic) {
        boolean retainMockAccuracy = getIntent().getBooleanExtra(Constants.EXTRA_RETAIN_MOCK_ACCURACY, false);
        locationTracker.start(retainMockAccuracy);
        recordPoint(map.getGpsLocation());
        schedulerHandler = scheduler.scheduleAtFixedRate(() -> runOnUiThread(() -> {
            Location currentLocation = locationTracker.getCurrentLocation();
            if (currentLocation != null) {
                MapPoint currentMapPoint = new MapPoint(currentLocation.getLatitude(), currentLocation.getLongitude(), currentLocation.getAltitude(), currentLocation.getAccuracy());
                recordPoint(currentMapPoint);
            }
        }), INTERVAL_OPTIONS[intervalIndex], INTERVAL_OPTIONS[intervalIndex], TimeUnit.SECONDS);
    }
    updateUi();
}
Also used : MapPoint(org.odk.collect.geo.maps.MapPoint) Location(org.odk.collect.location.Location)

Aggregations

MapPoint (org.odk.collect.geo.maps.MapPoint)1 Location (org.odk.collect.location.Location)1