Skip to content

Commit

Permalink
Merge pull request #158 from heremaps/esd/41220
Browse files Browse the repository at this point in the history
Update example apps for release 4.12.2.0
  • Loading branch information
maharudraabhishek authored Jul 21, 2022
2 parents 22dfed1 + 355a0b9 commit 67ca0d1
Show file tree
Hide file tree
Showing 344 changed files with 4,732 additions and 2,498 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's Guide_ f

> 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.12.1.0)
## List of Available Example Apps (Version 4.12.2.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.12.1.0
This folder contains the HERE SDK examples apps for version: 4.12.2.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: 1 addition & 1 deletion examples/latest/explore/android/Camera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Note: If your AAR version is different than the version shown in the _Developer'

2) Open Android Studio and sync the project.

Please do not forget: To run the app, you need to add your HERE SDK credentials to the `AndroidManifest.xml` file. More information can be found in the _Get Started_ section of the _Developer's Guide_.
Please do not forget: To run the app, you need to add your HERE SDK credentials to the `MainActivity.java` file. More information can be found in the _Get Started_ section of the _Developer's Guide_.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.here.sdk.camera">

<uses-permission android:name="android.permission.INTERNET" />
Expand All @@ -13,9 +15,13 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">

<!-- Set your credentials for the HERE SDK. -->
<meta-data android:name="com.here.sdk.access_key_id" android:value="YOUR_ACCESS_KEY_ID" />
<meta-data android:name="com.here.sdk.access_key_secret" android:value="YOUR_ACCESS_KEY_SECRET" />
<!-- Disable the InitProvider of the HERE SDK to prevent auto-initialization
until the InitProvider is removed with release 4.15.0. -->
<provider
android:name="com.here.sdk.engine.InitProvider"
android:authorities="com.here.sdk.engine.InitProvider"
android:exported="false"
tools:node="remove" />

<activity android:name=".MainActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package com.here.sdk.camera;

import android.content.Context;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
Expand All @@ -27,6 +28,8 @@

import com.here.sdk.camera.PermissionsRequestor.ResultListener;
import com.here.sdk.core.engine.SDKNativeEngine;
import com.here.sdk.core.engine.SDKOptions;
import com.here.sdk.core.errors.InstantiationErrorException;
import com.here.sdk.mapview.MapError;
import com.here.sdk.mapview.MapScene;
import com.here.sdk.mapview.MapScheme;
Expand All @@ -42,6 +45,10 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Usually, you need to initialize the HERE SDK only once during the lifetime of an application.
initializeHERESDK();

setContentView(R.layout.activity_main);

// Get a MapView instance from the layout.
Expand All @@ -51,6 +58,19 @@ protected void onCreate(Bundle savedInstanceState) {
handleAndroidPermissions();
}

private void initializeHERESDK() {
// Set your credentials for the HERE SDK.
String accessKeyID = "YOUR_ACCESS_KEY_ID";
String accessKeySecret = "YOUR_ACCESS_KEY_SECRET";
SDKOptions options = new SDKOptions(accessKeyID, accessKeySecret);
try {
Context context = this;
SDKNativeEngine.makeSharedInstance(context, options);
} catch (InstantiationErrorException e) {
throw new RuntimeException("Initialization of HERE SDK failed: " + e.error.name());
}
}

private void handleAndroidPermissions() {
permissionsRequestor = new PermissionsRequestor(this);
permissionsRequestor.request(new ResultListener(){
Expand Down Expand Up @@ -109,14 +129,20 @@ protected void onResume() {
@Override
protected void onDestroy() {
mapView.onDestroy();
disposeHERESDK();
super.onDestroy();
}

private void disposeHERESDK() {
// Free HERE SDK resources before the application shuts down.
SDKNativeEngine hereSDKEngine = SDKNativeEngine.getSharedInstance();
if (hereSDKEngine != null) {
hereSDKEngine.dispose();
// For safety reasons, we explicitly set the shared instance to null to avoid situations, where a disposed instance is accidentally reused.
// Usually, this should be called only on application termination.
// Afterwards, the HERE SDK is no longer usable unless it is initialized again.
SDKNativeEngine sdkNativeEngine = SDKNativeEngine.getSharedInstance();
if (sdkNativeEngine != null) {
sdkNativeEngine.dispose();
// For safety reasons, we explicitly set the shared instance to null to avoid situations,
// where a disposed instance is accidentally reused.
SDKNativeEngine.setSharedInstance(null);
}
super.onDestroy();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Note: If your AAR version is different than the version shown in the _Developer'

2) Open Android Studio and sync the project.

Please do not forget: To run the app, you need to add your HERE SDK credentials to the `AndroidManifest.xml` file. More information can be found in the _Get Started_ section of the _Developer's Guide_.
Please do not forget: To run the app, you need to add your HERE SDK credentials to the `MainActivity.java` file. More information can be found in the _Get Started_ section of the _Developer's Guide_.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.here.camerakeyframetracks">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -12,9 +14,13 @@
android:supportsRtl="true"
android:theme="@style/Theme.CameraKeyframeTracks">

<!-- Set your credentials for the HERE SDK. -->
<meta-data android:name="com.here.sdk.access_key_id" android:value="YOUR_ACCESS_KEY_ID" />
<meta-data android:name="com.here.sdk.access_key_secret" android:value="YOUR_ACCESS_KEY_SECRET" />
<!-- Disable the InitProvider of the HERE SDK to prevent auto-initialization
until the InitProvider is removed with release 4.15.0. -->
<provider
android:name="com.here.sdk.engine.InitProvider"
android:authorities="com.here.sdk.engine.InitProvider"
android:exported="false"
tools:node="remove" />

<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private List<ScalarKeyframe> createScalarKeyframes() {
// The duration indicates the time it takes to reach the scalar (= camera distance in meters) of the keyframe.
Collections.addAll(
scalarKeyframesList,
// Change the camera distance from 80000000 meters to 400 meters over time.
new ScalarKeyframe(80000000.0, Duration.ofMillis(0)),
new ScalarKeyframe(8000000.0, Duration.ofMillis(2000)),
new ScalarKeyframe(8000.0, Duration.ofMillis(2000)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package com.here.camerakeyframetracks;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
Expand All @@ -31,11 +32,12 @@

import com.here.sdk.core.GeoCoordinates;
import com.here.sdk.core.engine.SDKNativeEngine;
import com.here.sdk.core.engine.SDKOptions;
import com.here.sdk.core.errors.InstantiationErrorException;
import com.here.sdk.mapview.MapError;
import com.here.sdk.mapview.MapScene;
import com.here.sdk.mapview.MapScheme;
import com.here.sdk.mapview.MapView;
import com.here.sdk.mapview.VisibilityState;

public class MainActivity extends AppCompatActivity {

Expand All @@ -48,6 +50,10 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Usually, you need to initialize the HERE SDK only once during the lifetime of an application.
initializeHERESDK();

setContentView(R.layout.activity_main);

// Get a MapView instance from layout
Expand All @@ -57,6 +63,19 @@ protected void onCreate(Bundle savedInstanceState) {
handleAndroidPermissions();
}

private void initializeHERESDK() {
// Set your credentials for the HERE SDK.
String accessKeyID = "YOUR_ACCESS_KEY_ID";
String accessKeySecret = "YOUR_ACCESS_KEY_SECRET";
SDKOptions options = new SDKOptions(accessKeyID, accessKeySecret);
try {
Context context = this;
SDKNativeEngine.makeSharedInstance(context, options);
} catch (InstantiationErrorException e) {
throw new RuntimeException("Initialization of HERE SDK failed: " + e.error.name());
}
}

private void handleAndroidPermissions() {
permissionsRequestor = new PermissionsRequestor(this);
permissionsRequestor.request(new PermissionsRequestor.ResultListener(){
Expand Down Expand Up @@ -84,7 +103,11 @@ private void loadMapScene() {
@Override
public void onLoadScene(@Nullable MapError mapError) {
if (mapError == null) {
mapView.getMapScene().setLayerVisibility(MapScene.Layers.LANDMARKS, VisibilityState.VISIBLE);
// Users of the Navigate Edition can enable textured landmarks:
// Map<String, String> mapFeatures = new HashMap<>();
// mapFeatures.put(MapFeatures.LANDMARKS, MapFeatureModes.LANDMARKS_TEXTURED);
// mapView.getMapScene().enableFeatures(mapFeatures);

mapView.getCamera().lookAt(new GeoCoordinates(40.7133, -74.0112));
cameraKeyframeTracksExample = new CameraKeyframeTracksExample(mapView);
routeAnimationExample = new RouteAnimationExample(mapView);
Expand Down Expand Up @@ -139,14 +162,20 @@ protected void onResume() {
@Override
protected void onDestroy() {
mapView.onDestroy();
disposeHERESDK();
super.onDestroy();
}

private void disposeHERESDK() {
// Free HERE SDK resources before the application shuts down.
SDKNativeEngine hereSDKEngine = SDKNativeEngine.getSharedInstance();
if (hereSDKEngine != null) {
hereSDKEngine.dispose();
// For safety reasons, we explicitly set the shared instance to null to avoid situations, where a disposed instance is accidentally reused.
// Usually, this should be called only on application termination.
// Afterwards, the HERE SDK is no longer usable unless it is initialized again.
SDKNativeEngine sdkNativeEngine = SDKNativeEngine.getSharedInstance();
if (sdkNativeEngine != null) {
sdkNativeEngine.dispose();
// For safety reasons, we explicitly set the shared instance to null to avoid situations,
// where a disposed instance is accidentally reused.
SDKNativeEngine.setSharedInstance(null);
}
super.onDestroy();
}
}
2 changes: 1 addition & 1 deletion examples/latest/explore/android/CustomMapStyles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Note: If your AAR version is different than the version shown in the _Developer'

2) Open Android Studio and sync the project.

Please do not forget: To run the app, you need to add your HERE SDK credentials to the `AndroidManifest.xml` file. More information can be found in the _Get Started_ section of the _Developer's Guide_.
Please do not forget: To run the app, you need to add your HERE SDK credentials to the `MainActivity.java` file. More information can be found in the _Get Started_ section of the _Developer's Guide_.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.here.sdk.custommapstyles">

<uses-permission android:name="android.permission.INTERNET" />
Expand All @@ -13,9 +15,13 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">

<!-- Set your credentials for the HERE SDK. -->
<meta-data android:name="com.here.sdk.access_key_id" android:value="YOUR_ACCESS_KEY_ID" />
<meta-data android:name="com.here.sdk.access_key_secret" android:value="YOUR_ACCESS_KEY_SECRET" />
<!-- Disable the InitProvider of the HERE SDK to prevent auto-initialization
until the InitProvider is removed with release 4.15.0. -->
<provider
android:name="com.here.sdk.engine.InitProvider"
android:authorities="com.here.sdk.engine.InitProvider"
android:exported="false"
tools:node="remove" />

<activity android:name=".MainActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@

package com.here.sdk.custommapstyles;

import android.content.Context;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

import com.here.sdk.core.engine.SDKNativeEngine;
import com.here.sdk.core.engine.SDKOptions;
import com.here.sdk.core.errors.InstantiationErrorException;
import com.here.sdk.custommapstyles.PermissionsRequestor.ResultListener;
import com.here.sdk.mapview.MapError;
import com.here.sdk.mapview.MapScene;
Expand All @@ -42,6 +45,10 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Usually, you need to initialize the HERE SDK only once during the lifetime of an application.
initializeHERESDK();

setContentView(R.layout.activity_main);

// Get a MapView instance from the layout.
Expand All @@ -51,6 +58,19 @@ protected void onCreate(Bundle savedInstanceState) {
handleAndroidPermissions();
}

private void initializeHERESDK() {
// Set your credentials for the HERE SDK.
String accessKeyID = "YOUR_ACCESS_KEY_ID";
String accessKeySecret = "YOUR_ACCESS_KEY_SECRET";
SDKOptions options = new SDKOptions(accessKeyID, accessKeySecret);
try {
Context context = this;
SDKNativeEngine.makeSharedInstance(context, options);
} catch (InstantiationErrorException e) {
throw new RuntimeException("Initialization of HERE SDK failed: " + e.error.name());
}
}

private void handleAndroidPermissions() {
permissionsRequestor = new PermissionsRequestor(this);
permissionsRequestor.request(new ResultListener(){
Expand Down Expand Up @@ -105,14 +125,20 @@ protected void onResume() {
@Override
protected void onDestroy() {
mapView.onDestroy();
disposeHERESDK();
super.onDestroy();
}

private void disposeHERESDK() {
// Free HERE SDK resources before the application shuts down.
SDKNativeEngine hereSDKEngine = SDKNativeEngine.getSharedInstance();
if (hereSDKEngine != null) {
hereSDKEngine.dispose();
// For safety reasons, we explicitly set the shared instance to null to avoid situations, where a disposed instance is accidentally reused.
// Usually, this should be called only on application termination.
// Afterwards, the HERE SDK is no longer usable unless it is initialized again.
SDKNativeEngine sdkNativeEngine = SDKNativeEngine.getSharedInstance();
if (sdkNativeEngine != null) {
sdkNativeEngine.dispose();
// For safety reasons, we explicitly set the shared instance to null to avoid situations,
// where a disposed instance is accidentally reused.
SDKNativeEngine.setSharedInstance(null);
}
super.onDestroy();
}
}
4 changes: 2 additions & 2 deletions examples/latest/explore/android/CustomRasterLayers/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This example app shows how to load custom raster layers. You can find how this is done in [CustomRasterLayersExample.java](app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java).
This example app shows how to load custom raster layers. You can find how this is done in [CustomRasterLayersExample.java](app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java).

Build instructions:
-------------------
Expand All @@ -9,4 +9,4 @@ Note: If your AAR version is different than the version shown in the _Developer'

2) Open Android Studio and sync the project.

Please do not forget: To run the app, you need to add your HERE SDK credentials to the `AndroidManifest.xml` file. More information can be found in the _Get Started_ section of the _Developer's Guide_.
Please do not forget: To run the app, you need to add your HERE SDK credentials to the `MainActivity.java` file. More information can be found in the _Get Started_ section of the _Developer's Guide_.
Loading

0 comments on commit 67ca0d1

Please sign in to comment.