Skip to content

Commit

Permalink
Merge pull request #320 from heremaps/esd/41850
Browse files Browse the repository at this point in the history
Update example apps for release 4.18.5.0
  • Loading branch information
HERE-SDK-Support-Team committed Jun 12, 2024
2 parents 5a5cb0d + a080f5b commit 4c50906
Show file tree
Hide file tree
Showing 90 changed files with 453 additions and 293 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ For an overview of the existing features, please check the _Developer Guide_ for

> For now, the _Navigate Edition_ is only available upon request. Please contact your HERE representative to receive access including a set of evaluation credentials.
## List of Available Example Apps (Version 4.18.4.0)
## List of Available Example Apps (Version 4.18.5.0)

- **HelloMap**: Shows the classic 'Hello World'.
- **HelloMapKotlin**: Shows the classic 'Hello World' using Kotlin language (Android only).
Expand Down
2 changes: 1 addition & 1 deletion examples/latest/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This folder contains the HERE SDK examples apps for version: 4.18.4.0
This folder contains the HERE SDK examples apps for version: 4.18.5.0

- HERE SDK for Android ([Lite Edition](lite/android/), [Explore Edition](explore/android/), [Navigate Edition](navigate/android/))
- HERE SDK for iOS ([Lite Edition](lite/ios/), [Explore Edition](explore/ios/), [Navigate Edition](navigate/ios/))
Expand Down
2 changes: 2 additions & 0 deletions examples/latest/explore/android/MultiDisplays/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
The MultiDisplays example app shows how a HERE SDK map can be shown on two separate displays using Android's [Multi-Display API](https://source.android.com/devices/tech/display/multi_display/).

Note that this app requires **Android API 26 or higher**.

You can test this app with the emulator. In emulator options, select "Displays": You can then add up to two more displays. For this app, we only show content on two displays at the same time. Both displays show a map view instance, that can be used independently.

Note that you may need to update to a newer Android Studio version. The secondary screen feature can be used only on devices with Android 8 or higher.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import com.here.multidisplays.PermissionsRequestor.ResultListener;
Expand Down Expand Up @@ -68,6 +69,7 @@ public void onReceive(Context context, Intent intent) {
}
};

@RequiresApi(api = Build.VERSION_CODES.O)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -81,7 +83,7 @@ protected void onCreate(Bundle savedInstanceState) {
mapView = findViewById(R.id.map_view);
mapView.onCreate(savedInstanceState);

registerReceiver(dataBroadcast, dataBroadcast.getFilter(DataBroadcast.MESSAGE_FROM_SECONDARY_DISPLAY));
registerReceiver(dataBroadcast, dataBroadcast.getFilter(DataBroadcast.MESSAGE_FROM_SECONDARY_DISPLAY), Context.RECEIVER_EXPORTED);
handleAndroidPermissions();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.here.sdk.routing.RoutingError;
import com.here.sdk.routing.Section;
import com.here.sdk.routing.SectionNotice;
import com.here.sdk.routing.Span;
import com.here.sdk.routing.TransitRouteOptions;
import com.here.sdk.routing.TransitRoutingEngine;
import com.here.sdk.routing.TransitWaypoint;
Expand Down Expand Up @@ -111,12 +112,25 @@ public void onRouteCalculated(@Nullable RoutingError routingError, @Nullable Lis
// An implementation may decide to reject a route if one or more violations are detected.
private void logRouteViolations(Route route) {
for (Section section : route.getSections()) {
for (SectionNotice notice : section.getSectionNotices()) {
Log.e(TAG, "This route contains the following warning: " + notice.code.toString());
for (Span span : section.getSpans()) {
List<GeoCoordinates> spanGeometryVertices = span.getGeometry().vertices;
// This route violation spreads across the whole span geometry.
GeoCoordinates violationStartPoint = spanGeometryVertices.get(0);
GeoCoordinates violationEndPoint = spanGeometryVertices.get(spanGeometryVertices.size() - 1);
for (int index : span.getNoticeIndexes()) {
SectionNotice spanSectionNotice = section.getSectionNotices().get(index);
// The violation code such as "VIOLATED_VEHICLE_RESTRICTION".
String violationCode = spanSectionNotice.code.toString();
Log.d(TAG, "The violation " + violationCode + " starts at " + toString(violationStartPoint) + " and ends at " + toString(violationEndPoint) + " .");
}
}
}
}

private String toString(GeoCoordinates geoCoordinates) {
return geoCoordinates.latitude + ", " + geoCoordinates.longitude;
}

private void showRouteDetails(Route route) {
long estimatedTravelTimeInSeconds = route.getDuration().getSeconds();
int lengthInMeters = route.getLengthInMeters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,25 @@ public void onRouteCalculated(@Nullable RoutingError routingError, @Nullable Lis
// An implementation may decide to reject a route if one or more violations are detected.
private void logRouteViolations(Route route) {
for (Section section : route.getSections()) {
for (SectionNotice notice : section.getSectionNotices()) {
Log.e(TAG, "This route contains the following warning: " + notice.code.toString());
for (Span span : section.getSpans()) {
List<GeoCoordinates> spanGeometryVertices = span.getGeometry().vertices;
// This route violation spreads across the whole span geometry.
GeoCoordinates violationStartPoint = spanGeometryVertices.get(0);
GeoCoordinates violationEndPoint = spanGeometryVertices.get(spanGeometryVertices.size() - 1);
for (int index : span.getNoticeIndexes()) {
SectionNotice spanSectionNotice = section.getSectionNotices().get(index);
// The violation code such as "VIOLATED_VEHICLE_RESTRICTION".
String violationCode = spanSectionNotice.code.toString();
Log.d(TAG, "The violation " + violationCode + " starts at " + toString(violationStartPoint) + " and ends at " + toString(violationEndPoint) + " .");
}
}
}
}

private String toString(GeoCoordinates geoCoordinates) {
return geoCoordinates.latitude + ", " + geoCoordinates.longitude;
}

private void logRouteSectionDetails(Route route) {
DateFormat dateFormat = new SimpleDateFormat("HH:mm");

Expand Down Expand Up @@ -330,10 +343,10 @@ private void showTrafficOnRoute(Route route) {
MapPolyline trafficSpanMapPolyline = null;
try {
trafficSpanMapPolyline = new MapPolyline(span.getGeometry(), new MapPolyline.SolidRepresentation(
new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels),
lineColor,
LineCap.ROUND));
} catch (MapPolyline.Representation.InstantiationException e) {
new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels),
lineColor,
LineCap.ROUND));
} catch (MapPolyline.Representation.InstantiationException e) {
Log.e("MapPolyline Representation Exception:", e.error.name());
} catch (MapMeasureDependentRenderSize.InstantiationException e) {
Log.e("MapMeasureDependentRenderSize Exception:", e.error.name());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,25 @@ class RoutingExample {
// An implementation may decide to reject a route if one or more violations are detected.
void _logRouteViolations(here.Route route) {
for (var section in route.sections) {
for (var notice in section.sectionNotices) {
print("This route contains the following warning: " + notice.code.toString());
for (var span in section.spans) {
List<GeoCoordinates> spanGeometryVertices = span.geometry.vertices;
// This route violation spreads across the whole span geometry.
GeoCoordinates violationStartPoint = spanGeometryVertices[0];
GeoCoordinates violationEndPoint = spanGeometryVertices[spanGeometryVertices.length - 1];
for (var index in span.noticeIndexes) {
SectionNotice spanSectionNotice = section.sectionNotices[index];
// The violation code such as "violatedVehicleRestriction".
var violationCode = spanSectionNotice.code.toString();
print("The violation $violationCode starts at ${_toString(violationStartPoint)} and ends at ${_toString(violationEndPoint)} .");
}
}
}
}

String _toString(GeoCoordinates geoCoordinates){
return "${geoCoordinates.latitude}, ${geoCoordinates.longitude}";
}

void _logTollDetails(here.Route route) {
for (Section section in route.sections) {
// The spans that make up the polyline along which tolls are required or
Expand Down
24 changes: 22 additions & 2 deletions examples/latest/explore/ios/Routing/Routing/RoutingExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,31 @@ class RoutingExample {
private func logRouteViolations(route: Route) {
let sections = route.sections
for section in sections {
for notice in section.sectionNotices {
print("This route contains the following warning: \(notice.code)")
for span in section.spans {
let spanGeometryVertices = span.geometry.vertices;
// This route violation spreads across the whole span geometry.
guard let violationStartPoint: GeoCoordinates = spanGeometryVertices.first else {
print("Error: violation start geocoordinate is empty.")
return
};
guard let violationEndPoint : GeoCoordinates = spanGeometryVertices.last else {
print("Error: violation end geocoordinate is empty.")
return
};
for index in span.noticeIndexes{
let spanSectionNotice : SectionNotice = section.sectionNotices[Int(index)];
// The violation code such as "violatedVehicleRestriction".
let violationCode = spanSectionNotice.code;
print("The violation \(violationCode) starts at \(toString(geoCoordinates: violationStartPoint)) and ends at \(toString(geoCoordinates: violationEndPoint)) .");

}
}
}
}

private func toString(geoCoordinates: GeoCoordinates) -> String {
return String(geoCoordinates.latitude) + ", " + String(geoCoordinates.longitude);
}

private func logRouteSectionDetails(route: Route) {
let dateFormatter = DateFormatter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -275,12 +275,13 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.5;
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = here.examples.UnitTests;
PRODUCT_BUNDLE_IDENTIFIER = com.here.sdk.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
Expand All @@ -296,11 +297,12 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.5;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = here.examples.UnitTests;
PRODUCT_BUNDLE_IDENTIFIER = com.here.sdk.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 2 additions & 0 deletions examples/latest/navigate/android/MultiDisplays/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
The MultiDisplays example app shows how a HERE SDK map can be shown on two separate displays using Android's [Multi-Display API](https://source.android.com/devices/tech/display/multi_display/).

Note that this app requires **Android API 26 or higher**.

You can test this app with the emulator. In emulator options, select "Displays": You can then add up to two more displays. For this app, we only show content on two displays at the same time. Both displays show a map view instance, that can be used independently.

Note that you may need to update to a newer Android Studio version. The secondary screen feature can be used only on devices with Android 8 or higher.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import com.here.multidisplays.PermissionsRequestor.ResultListener;
Expand Down Expand Up @@ -68,6 +69,7 @@ public void onReceive(Context context, Intent intent) {
}
};

@RequiresApi(api = Build.VERSION_CODES.O)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -81,7 +83,7 @@ protected void onCreate(Bundle savedInstanceState) {
mapView = findViewById(R.id.map_view);
mapView.onCreate(savedInstanceState);

registerReceiver(dataBroadcast, dataBroadcast.getFilter(DataBroadcast.MESSAGE_FROM_SECONDARY_DISPLAY));
registerReceiver(dataBroadcast, dataBroadcast.getFilter(DataBroadcast.MESSAGE_FROM_SECONDARY_DISPLAY), Context.RECEIVER_EXPORTED);
handleAndroidPermissions();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.here.sdk.routing.RoutingError;
import com.here.sdk.routing.Section;
import com.here.sdk.routing.SectionNotice;
import com.here.sdk.routing.Span;
import com.here.sdk.routing.TransitRouteOptions;
import com.here.sdk.routing.TransitRoutingEngine;
import com.here.sdk.routing.TransitWaypoint;
Expand Down Expand Up @@ -111,12 +112,25 @@ public void onRouteCalculated(@Nullable RoutingError routingError, @Nullable Lis
// An implementation may decide to reject a route if one or more violations are detected.
private void logRouteViolations(Route route) {
for (Section section : route.getSections()) {
for (SectionNotice notice : section.getSectionNotices()) {
Log.e(TAG, "This route contains the following warning: " + notice.code.toString());
for (Span span : section.getSpans()) {
List<GeoCoordinates> spanGeometryVertices = span.getGeometry().vertices;
// This route violation spreads across the whole span geometry.
GeoCoordinates violationStartPoint = spanGeometryVertices.get(0);
GeoCoordinates violationEndPoint = spanGeometryVertices.get(spanGeometryVertices.size() - 1);
for (int index : span.getNoticeIndexes()) {
SectionNotice spanSectionNotice = section.getSectionNotices().get(index);
// The violation code such as "VIOLATED_VEHICLE_RESTRICTION".
String violationCode = spanSectionNotice.code.toString();
Log.d(TAG, "The violation " + violationCode + " starts at " + toString(violationStartPoint) + " and ends at " + toString(violationEndPoint) + " .");
}
}
}
}

private String toString(GeoCoordinates geoCoordinates) {
return geoCoordinates.latitude + ", " + geoCoordinates.longitude;
}

private void showRouteDetails(Route route) {
long estimatedTravelTimeInSeconds = route.getDuration().getSeconds();
int lengthInMeters = route.getLengthInMeters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,25 @@ public void onRouteCalculated(@Nullable RoutingError routingError, @Nullable Lis
// An implementation may decide to reject a route if one or more violations are detected.
private void logRouteViolations(Route route) {
for (Section section : route.getSections()) {
for (SectionNotice notice : section.getSectionNotices()) {
Log.e(TAG, "This route contains the following warning: " + notice.code.toString());
for (Span span : section.getSpans()) {
List<GeoCoordinates> spanGeometryVertices = span.getGeometry().vertices;
// This route violation spreads across the whole span geometry.
GeoCoordinates violationStartPoint = spanGeometryVertices.get(0);
GeoCoordinates violationEndPoint = spanGeometryVertices.get(spanGeometryVertices.size() - 1);
for (int index : span.getNoticeIndexes()) {
SectionNotice spanSectionNotice = section.getSectionNotices().get(index);
// The violation code such as "VIOLATED_VEHICLE_RESTRICTION".
String violationCode = spanSectionNotice.code.toString();
Log.d(TAG, "The violation " + violationCode + " starts at " + toString(violationStartPoint) + " and ends at " + toString(violationEndPoint) + " .");
}
}
}
}

private String toString(GeoCoordinates geoCoordinates) {
return geoCoordinates.latitude + ", " + geoCoordinates.longitude;
}

private void logRouteSectionDetails(Route route) {
DateFormat dateFormat = new SimpleDateFormat("HH:mm");

Expand Down Expand Up @@ -330,10 +343,10 @@ private void showTrafficOnRoute(Route route) {
MapPolyline trafficSpanMapPolyline = null;
try {
trafficSpanMapPolyline = new MapPolyline(span.getGeometry(), new MapPolyline.SolidRepresentation(
new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels),
lineColor,
LineCap.ROUND));
} catch (MapPolyline.Representation.InstantiationException e) {
new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels),
lineColor,
LineCap.ROUND));
} catch (MapPolyline.Representation.InstantiationException e) {
Log.e("MapPolyline Representation Exception:", e.error.name());
} catch (MapMeasureDependentRenderSize.InstantiationException e) {
Log.e("MapMeasureDependentRenderSize Exception:", e.error.name());
Expand Down
Loading

0 comments on commit 4c50906

Please sign in to comment.