Skip to content

Commit 3f7a572

Browse files
Merge pull request #301 from heremaps/esd/41730
Update example apps for release 4.17.3.0
2 parents 964e879 + 7f5ba10 commit 3f7a572

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ For an overview of the existing features, please check the _Developer Guide_ for
2626

2727
> For now, the _Navigate Edition_ is only available upon request. Please contact your HERE representative to receive access including a set of evaluation credentials.
2828
29-
## List of Available Example Apps (Version 4.17.2.0)
29+
## List of Available Example Apps (Version 4.17.3.0)
3030

3131
- **HelloMap**: Shows the classic 'Hello World'.
3232
- **HelloMapKotlin**: Shows the classic 'Hello World' using Kotlin language (Android only).

examples/latest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This folder contains the HERE SDK examples apps for version: 4.17.2.0
1+
This folder contains the HERE SDK examples apps for version: 4.17.3.0
22

33
- HERE SDK for Android ([Lite Edition](lite/android/), [Explore Edition](explore/android/), [Navigate Edition](navigate/android/))
44
- HERE SDK for iOS ([Lite Edition](lite/ios/), [Explore Edition](explore/ios/), [Navigate Edition](navigate/ios/))

examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/App.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public class App {
6363
private final RouteCalculator routeCalculator;
6464
private final NavigationExample navigationExample;
6565
private final TextView messageView;
66+
private boolean isCameraTrackingEnabled = true;
6667

6768
public App(Context context, MapView mapView, TextView messageView) {
6869
this.context = context;
@@ -102,10 +103,12 @@ public void clearMapButtonPressed() {
102103
public void toggleTrackingButtonOnClicked() {
103104
// By default, this is enabled.
104105
navigationExample.startCameraTracking();
106+
isCameraTrackingEnabled = true;
105107
}
106108

107109
public void toggleTrackingButtonOffClicked() {
108110
navigationExample.stopCameraTracking();
111+
isCameraTrackingEnabled = false;
109112
}
110113

111114
private void calculateRoute(boolean isSimulated) {
@@ -203,7 +206,7 @@ public void clearMap() {
203206
clearWaypointMapMarker();
204207
clearRoute();
205208

206-
navigationExample.stopNavigation();
209+
navigationExample.stopNavigation(isCameraTrackingEnabled);
207210
}
208211

209212
private void clearWaypointMapMarker() {
@@ -279,14 +282,14 @@ private void showStartNavigationDialog(String title, String message, Route route
279282
.setMessage(message)
280283
.setNeutralButton(buttonText,
281284
(dialog, which) -> {
282-
navigationExample.startNavigation(route, isSimulated);
285+
navigationExample.startNavigation(route, isSimulated, isCameraTrackingEnabled);
283286
})
284287
.show();
285288
}
286289

287290
public void detach() {
288291
// Disables TBT guidance (if running) and enters tracking mode.
289-
navigationExample.stopNavigation();
292+
navigationExample.stopNavigation(isCameraTrackingEnabled);
290293
// Disables positioning.
291294
navigationExample.stopLocating();
292295
// Disables rendering.

examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/NavigationExample.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private void createDynamicRoutingEngine() {
128128
}
129129
}
130130

131-
public void startNavigation(Route route, boolean isSimulated) {
131+
public void startNavigation(Route route, boolean isSimulated, boolean isCameraTrackingEnabled) {
132132
GeoCoordinates startGeoCoordinates = route.getGeometry().vertices.get(0);
133133
prefetchMapData(startGeoCoordinates);
134134

@@ -147,6 +147,9 @@ public void startNavigation(Route route, boolean isSimulated) {
147147
}
148148

149149
startDynamicSearchForBetterRoutes(route);
150+
151+
// Synchronize with the toggle button state.
152+
updateCameraTracking(isCameraTrackingEnabled);
150153
}
151154

152155
private void startDynamicSearchForBetterRoutes(Route route) {
@@ -179,8 +182,10 @@ public void onRoutingError(@NonNull RoutingError routingError) {
179182
}
180183
}
181184

182-
public void stopNavigation() {
185+
public void stopNavigation(boolean isCameraTrackingEnabled) {
183186
// Switches to tracking mode when a route was set before, otherwise tracking mode is kept.
187+
// Note that tracking mode means that the visual navigator will continue to run, but without
188+
// turn-by-turn instructions - this can be done with or without camera tracking.
184189
// Without a route the navigator will only notify on the current map-matched location
185190
// including info such as speed and current street name.
186191
visualNavigator.setRoute(null);
@@ -191,6 +196,17 @@ public void stopNavigation() {
191196

192197
dynamicRoutingEngine.stop();
193198
routePrefetcher.stopPrefetchAroundRoute();
199+
200+
// Synchronize with the toggle button state.
201+
updateCameraTracking(isCameraTrackingEnabled);
202+
}
203+
204+
private void updateCameraTracking(boolean isCameraTrackingEnabled) {
205+
if (isCameraTrackingEnabled) {
206+
startCameraTracking();
207+
} else {
208+
stopCameraTracking();
209+
}
194210
}
195211

196212
// Provides simulated location updates based on the given route.

0 commit comments

Comments
 (0)