Search in sources :

Example 1 with MapEngine

use of com.here.android.mpa.common.MapEngine in project here-android-sdk-examples by heremaps.

the class PositioningService method initMapEngine.

/**
 * Initialize HERE SDK map engine.
 */
private void initMapEngine() {
    if (MapEngine.isInitialized()) {
        return;
    }
    final MapEngine engine = MapEngine.getInstance();
    engine.init(new ApplicationContext(getApplicationContext()), new OnEngineInitListener() {

        @Override
        public void onEngineInitializationCompleted(Error error) {
            if (error == OnEngineInitListener.Error.NONE) {
                mNotificationUtils.updateNotification(R.drawable.ic_paused, R.string.notificationTitle, R.string.notificationMapEngineReady);
                if (mListener != null) {
                    try {
                        mListener.onEngineIntialized();
                    } catch (RemoteException ex) {
                    // ignored
                    }
                }
                final PositioningManager posManager = PositioningManager.getInstance();
                final LocationDataSource hereLocation = LocationDataSourceHERE.getInstance();
                if (hereLocation == null) {
                    Log.e(TAG, "initMapEngine: failed to instantiate HERE location");
                    return;
                }
                posManager.setDataSource(hereLocation);
            } else {
                Log.e(TAG, "initMapEngine: MapEngine.init failed: " + error.getDetails());
            }
        }
    });
}
Also used : MapEngine(com.here.android.mpa.common.MapEngine) ApplicationContext(com.here.android.mpa.common.ApplicationContext) PositioningManager(com.here.android.mpa.common.PositioningManager) OnEngineInitListener(com.here.android.mpa.common.OnEngineInitListener) RemoteException(android.os.RemoteException) LocationDataSource(com.here.android.mpa.common.LocationDataSource)

Aggregations

RemoteException (android.os.RemoteException)1 ApplicationContext (com.here.android.mpa.common.ApplicationContext)1 LocationDataSource (com.here.android.mpa.common.LocationDataSource)1 MapEngine (com.here.android.mpa.common.MapEngine)1 OnEngineInitListener (com.here.android.mpa.common.OnEngineInitListener)1 PositioningManager (com.here.android.mpa.common.PositioningManager)1