HERE Android SDK Developer's Guide

MapEngine Class

MapEngine is a singleton class used to manage active mapping resources for use in applications developed with the HERE SDK. MapEngine must be initialized before Map and map-related objects, such as MapMarker and Places, can be instantiated and retrieved from the API. A runtime exception occurs if MapEngine is not properly initialized before map-related objects are used.

Initialization

MapEngine must be initialized before it can be used. MapEngine is automatically initialized for your application by using MapFragment. MapFragment is a fragment class that applications can use as an UI module in an activity for map display. However, if your application does not use MapFragment classes, then the application should initialize the MapEngine directly before using any HERE APIs. You can do this by calling MapEngine.init(Context, OnEngineInitListener) as shown below:

MapEngine mapEngine = MapEngine.getInstance();
mapEngine.init(context, new OnEngineInitListener() {
  @Override
  public void onEngineInitializatonCompleted(Error error) {
    if (error == OnEngineInitListener.Error.NONE) {
      // Post initialization code goes here
    } else {
      // handle factory initialization failure
    }
  }
});

If map engine initialization is in progress or has failed, calling any other HERE SDK APIs fails because invalid objects cannot be created. To avoid this problem, check for MapEngine.isInitialized() in your app lifecycle callbacks. For example, the following example avoids problems with using the PositionManager before an instance can be properly created:

public void onDestroy()
{
  //Set initComplete using MapEngine.isInitialized()
  if (initComplete) {
    PositioningManager.getInstance().removeListener(this);
  }
  super.onDestroy();
}

For examples of typical scenarios using the MapFragment that automatically initializes the MapEngine, see Maps.

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.