public void rememberTrailPosition(final Location coordinates) {
        if (coordinates.getAccuracy() >= 50f) {
            return;
        }
        if (coordinates.getLatitude() == 0.0 && coordinates.getLongitude() == 0.0) {
            return;
        }
        if (GeoData.isArtificialLocationProvider(coordinates.getProvider())) {
            return;
        }
        if (history.isEmpty()) {
            saveToStorage(coordinates);
            history.add(new TrailHistoryElement(coordinates));
            return;
        }

        final TrailHistoryElement historyRecent = history.get(history.size() - 1);
        if (historyRecent.distanceTo(coordinates) <= MINIMUM_DISTANCE_METERS) {
            return;
        }

        saveToStorage(coordinates);
        history.add(new TrailHistoryElement(coordinates));

        // avoid running out of memory
        final int itemsToRemove = getHistory().size() - MAX_POSITIONS;
        if (itemsToRemove > 0) {
            getHistory().subList(0, itemsToRemove).clear();
        }
    }
Adds the current position to the trail history to be able to show the trail on the map.
main/src/main/java/cgeo/geocaching/maps/PositionHistory.java