HERE Android SDK Developer's Guide

MapEngine

The class MapEngine is a member of com.here.android.mpa.common .

Class Summary

public final class MapEngine

extends java.lang.Object

MapEngine manages all mapping resources and services provided in this SDK.

[For complete information, see the section Class Details]

Method Summary

Table 1. Methods in MapEngine
Methods

public static MapEngine getInstance ()

Returns the MapEngine singleton, if one has already been created.

public void init (Context context, OnEngineInitListener listener)

Asynchronously initialize the MapEngine .

public void onPause ()

Decrements the reference count of map resource usage.

public void onResume ()

Increments the reference count of map resource usage.

Class Details

MapEngine manages all mapping resources and services provided in this SDK.

MapEngine must be initialized before any of the services can be used. For more information, see init(Context, OnEngineInitListener).

Users can maintain reference count through the use of onPause() and onResume() thus control when to relinquish MapEngine services.

Method Details

public static MapEngine getInstance ()

Returns the MapEngine singleton, if one has already been created.

Once the MapEngine instance is available, it must be initialized through one of the following methods before it can be used:

Returns:

MapEngine instance

public void init (Context context, OnEngineInitListener listener)

Asynchronously initialize the MapEngine . MapEngine cannot be used until it has been initialized successfully. This method is particularly useful for users of headless APIs as the MapEngine is being automatically initialized as part of the setup process of MapFragments or

Parameters:

  • context

    context to be used during initialization.

  • listener

    OnEngineInitListener to provide information when MapEngine initialization completes and if it has been successful.

See also:

MapFragment#init(OnEngineInitListener)

MapFragment#init(Context, OnEngineInitListener)

public void onPause ()

Decrements the reference count of map resource usage. When the count drops to 0 the engine will be paused. This should usually be called in an activity's onPause .

For users of MapFragment, and MapActivity classes, it is not necessary to call onPause() as it is handled automatically.

public void onResume ()

Increments the reference count of map resource usage. This will open all mapping resources if the reference count becomes 1. This should usually be called in an activity's onResume . For users of MapFragment, and MapActivity classes, it is not necessary to call onResume() as it is handled automatically.