HERE Android SDK Developer's Guide

Running the Sample Application

This tutorial contains instructions on how to run the basic sample application to render a map on an Android device. This tutorial assumes that you are using the Android Studio development environment and a supported Android device. For more details, see System Requirements.

Development tasks for this basic application include:
  • Check HERE Credentials.
  • Open the sample project in Android Studio.
  • Import the necessary resources into the project.
Note: HERE Android SDK is now distributed as an .AAR instead of a .JAR, and the basic sample app is also updated. If you are upgrading your existing project from an older version of the HERE SDK, be sure to modify the project by following the instructions in Development Tips.

Check Credentials

This sample application is already configured with a set of HERE SDK credentials for evaluation purposes. You can check these credentials by opening the BasicMapSolution/app/src/main/AndroidManifest.xml file and inspecting the following <meta-data> tags:

  • <meta-data android:name="com.here.android.maps.appid" android:value="{SAMPLE_APP_ID}"/>
  • <meta-data android:name="com.here.android.maps.apptoken" android:value="{SAMPLE_APP_CODE}"/>
  • <meta-data android:name="com.here.android.maps.license.key" android:value="{SAMPLE_LICENSE}"/>"/>

Typically, before developing a new HERE SDK application, you need to acquire a set of credentials by registering your application on http://developer.here.com. Each application requires a unique set of credentials. When you register your app, the registered bundle identifier must match the package name in your project.

Open the Sample Project in Android Studio

The next task before running the sample HERE SDK project is to locate the project folder and open it in Android Studio as follows:

  1. In the Welcome to Android Studio dialogue box, select Open an existing Android Studio project.
  2. In the Open File or Project dialogue box, select the BasicMapSolution folder from your file system and click OK. The main Android Studio project window should appear with an error "Error: Failed to resolve: :HERE-sdk:" in the Messages pane.

Import the HERE SDK Android Archive

The HERE Android SDK library is shipped as an Android Archive (.AAR) file. You can import this library by doing the following:

  1. On the View menu, click Tool Windows > Project.
  2. A few tabs are available in this tool window. Select the Project tab to show a file system view of the application structure.
  3. Right-click on the app folder and select New > Directory to create a new folder. Use libs as the new folder name.
  4. In your operating system's file system, navigate to the extracted HERE SDK directory. Copy the HERE-sdk.aar file and paste it into the newly created libs directory.
  5. Open the build.gradle file under the app folder and ensure the following entries are present:
    repositories {
      flatDir {
        dirs 'libs'
      }
    }
    
    dependencies {
      compile(name:'HERE-sdk', ext:'aar')
      // Depending on your specific project configuration, you may have other entries here.
    }
    
  6. Optional: To enable quick Javadoc reference within your Android Studio environment, scroll down to the External Libraries section, right-click on HERE-sdk, and then select Library Properties. Click the + button and locate HERE-sdk-javadoc.jar from the HERE SDK package.
Note: You can also import HERE-sdk.aar by using the menu, selecting File > Project Structure... and clicking the "+" button. If you use this method, ensure that HERE-sdk is listed properly under the app Module Dependencies.
Figure 1. Location of the .AAR file

Run the Project

You can run your simple application by pressing the key combination Shift + F10 (or Ctrl + R on macOS) from within Android Studio. The application renders a map retrieved from the HERE servers. When you are running your application on a device, make sure a data connection is enabled.

Note: For detailed instructions on how to create a new HERE SDK app, see Creating a Simple Application Using the HERE SDK

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.