Mobility On-Demand Technical Solution Paper

Authenticating Applications

To use HERE services in your apps and backend, you must request a set of credentials and use the app_id and app_code details you receive in your applications. If you do not include an authentication component in your application, your applications are unable to successfully request the relevant information.

Everything you need to support the examples in the Technical Solution Paper is available when you sign up for a 90-day Free Trial license on developer.here.com. Click here.

Once you’ve tried things out and you’re ready to move to a commercial implementation of your mobility on-demand app, please contact us. We have commercial licensing options based on rides, tasks, and bookings to give you the flexibility you need.

The sections below provide additional details about how to authenticate your application in different technologies.

Authenticating Android Applications

To authenticate an android application:

  1. In your development environment, double-click your project's AndroidManifest.xml file and ensure that you are viewing the file in text editor mode.
  2. In the <application></application> tag block, add the following markup directly beneath the <activity></activity> tag:
    
    <meta-data android:name="com.here.android.maps.appid"
    android:value="{YOUR_APP_ID}"/>
    <meta-data android:name="com.here.android.maps.apptoken"
    android:value="{YOUR_APP_CODE}"/>
    
  3. Replace {YOUR_APP_ID} and {YOUR_APP_ID} with the appropriate credentials for your application.

Authenticating iOS Applications

To authenticate an iOS application:

  1. Set your app_id and app_code credentials in your app delegate:
    
                - (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
      [NMAApplicationContext setAppId:@"{YOUR_APP_ID}" appCode:@"{YOUR_APP_CODE}"];
    
      return YES;
    }
              

Authenticating JavaScript Applications

To authenticate a JavaScript application:

  1. In your JavaScript implementation, add your app_id and app_code credentials to the parameters you send to the REST API.
    There are many ways to do this, but one possible implementation would look as follows (for the Matrix Routing API):
    var requestParams = _({
      'mode': mode,
      'summaryAttributes': 'traveltime',
      'app_id': {YOUR_APP_ID},
      'app_code': {YOUR_APP_CODE}
      }).assign(startParams.value())
      .assign(destinationParams.value())
      .map((value, key) => {
      return key + '=' + encodeURIComponent(value);
      }).join('&');

    Note that some of the components in this structure are defined elsewhere.

  2. Replace {YOUR_APP_ID} and {YOUR_APP_ID} with the appropriate credentials for your application.