title: HERE-maps Not allowed to start service Intent
body: <p>I am building navigation app using HERE-Maps and <a href="https://github.com/heremaps/here-android-sdk-examples/tree/master/positioning" rel="nofollow noreferrer">this Github</a> example, I replicated most of the code, I created new credentials for my app and followed steps written in documentation. But my code is crashing on <code>EngineInitializationCompleted</code> I think its because of some mistake I did in Manifest, Regarding Map Service or Disk cache.</p>
  
  <p><strong>I am getting this error below:</strong></p>
  
  <pre><code>03-28 13:16:21.077 26352-26352/propelit.actionopps.com.propelit D/xxxxxx: Unknown error occurred.
      java.lang.SecurityException: Not allowed to start service Intent { act={YOUR_INTENT_NAME} cmp=com.here.android.example.basicpositioningsolution/com.here.android.mpa.service.MapService (has extras) } without permission not exported from uid 10205
          at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1418)
          at android.app.ContextImpl.startService(ContextImpl.java:1395)
          at android.content.ContextWrapper.startService(ContextWrapper.java:623)
          at com.nokia.maps.MapServiceClient.a(MapServiceClient.java:77)
          at com.nokia.maps.MapsEngine.a(MapsEngine.java:621)
          at com.nokia.maps.MapsEngine.a(MapsEngine.java:363)
          at com.here.android.mpa.common.MapEngine.init(MapEngine.java:261)
          at com.nokia.maps.bw.a(MapFragmentImpl.java:132)
          at com.here.android.mpa.mapping.MapFragment.init(MapFragment.java:112)
          at propelit.actionopps.com.propelit.MainActivity.initializeMapsAndPositioning(MainActivity.java:178)
          at propelit.actionopps.com.propelit.MainActivity.onRequestPermissionsResult(MainActivity.java:369)
          at propelit.actionopps.com.propelit.MainActivity.checkPermissions(MainActivity.java:350)
          at propelit.actionopps.com.propelit.MainActivity.onCreate(MainActivity.java:79)
          at android.app.Activity.performCreate(Activity.java:6852)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2658)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2766)
          at android.app.ActivityThread.-wrap12(ActivityThread.java)
  </code></pre>
  
  <p><strong>My Manifest.xml :</strong></p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="propelit.actionopps.com.propelit"&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/&gt;
      &lt;!-- To auto-complete the email text field in the login form with the user's emails --&gt;
      &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
      &lt;uses-permission android:name="android.permission.READ_PROFILE" /&gt;
      &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
  
  
      &lt;uses-permission android:name="android.permission.BLUETOOTH"/&gt;
      &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/&gt;
      &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/&gt;
      &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/&gt;
      &lt;uses-permission android:maxSdkVersion="22" android:name="android.permission.READ_PHONE_STATE"/&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK"/&gt;
  
      &lt;application
  
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:screenOrientation="portrait"
          android:theme="@style/AppTheme"
          android:label="@string/app_name" android:hardwareAccelerated="true"&gt;
  
  
          &lt;meta-data android:name="com.here.android.maps.appid" android:value="skxxxxxxxxxxxxxxxxZO"/&gt;
          &lt;meta-data android:name="com.here.android.maps.apptoken" android:value="Dgm_cxxxxxxxxxxxxxxv6FGEeQ"/&gt;
          &lt;meta-data android:name="com.here.android.maps.license.key" android:value="hZxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxZuC0m2vtXunxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5wZVsq1Li2RSU="/&gt;
  
          &lt;activity android:name=".MainActivity"
              android:screenOrientation="portrait"&gt;
  
          &lt;/activity&gt;
  
  
          &lt;activity
              android:name=".SplashScreen"
              android:configChanges="orientation|keyboardHidden|screenSize"
              android:label="@string/app_name"
              android:screenOrientation="portrait"
              android:theme="@style/Theme.AppCompat.Light.NoActionBar"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:screenOrientation="portrait"
              android:name=".LoginActivity"
              android:label="@string/title_activity_login"
              android:theme="@style/Theme.AppCompat.Light.NoActionBar"&gt;
          &lt;/activity&gt;
          &lt;meta-data
              android:name="INTENT_NAME"
              android:value="{YOUR_INTENT_NAME}" /&gt;
          &lt;service
              android:name="com.here.android.mpa.service.MapService"
              android:label="{YOUR_LABEL_NAME}"
              android:exported="false"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="{YOUR_INTENT_NAME}"&gt;
  
                  &lt;/action&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          &lt;!--
              Embed the HERE Positioning Service.
              For more information, see the HERE SDK Developer's Guide
          --&gt;
          &lt;service android:enabled="true" android:exported="false" android:name="com.here.services.internal.LocationService" android:process=":remote"&gt;
          &lt;/service&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>My MainActivity:</strong></p>
  
  <pre><code> @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
        //  setContentView(R.layout.activity_main);
          checkPermissions();
  
  
      private void initializeMapsAndPositioning() {
          setContentView(R.layout.activity_main);
          mTopToolbar = (Toolbar) findViewById(R.id.toolbar);
          rotateLoading = (RotateLoading) findViewById(R.id.progressBar2);
          setSupportActionBar(mTopToolbar);
          getSupportActionBar().setDisplayShowTitleEnabled(false);
          NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
          if (navigationView != null) {
              navigationView.setNavigationItemSelectedListener(this);
          }
          mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                  this, mDrawer, mTopToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
          mDrawer.addDrawerListener(toggle);
          toggle.syncState();
          Window window = this.getWindow();
  
  // clear FLAG_TRANSLUCENT_STATUS flag:
          window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  
  // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
          window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
  
  // finally change the color
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
              window.setStatusBarColor(ContextCompat.getColor(this ,R.color.colorPrimaryDark));
          }
          mLocationInfo = (TextView) findViewById(R.id.textViewLocationInfo);
          mapFragment = (MapFragment)getFragmentManager().findFragmentById(
                  R.id.mapfragment);
          mapFragment.setRetainInstance(false);
  
          // Set path of isolated disk cache
          String diskCacheRoot = Environment.getExternalStorageDirectory().getPath()
                  + File.separator + ".isolated-here-maps";
          // Retrieve intent name from manifest
          String intentName = "";
          try {
              ApplicationInfo ai = getPackageManager().getApplicationInfo(this.getPackageName(), PackageManager.GET_META_DATA);
              Bundle bundle = ai.metaData;
              intentName = bundle.getString("INTENT_NAME");
          } catch (PackageManager.NameNotFoundException e) {
              Log.e(this.getClass().toString(), "Failed to find intent name, NameNotFound: " + e.getMessage());
          }
          Toast.makeText(MainActivity.this, "before", Toast.LENGTH_SHORT).show();
          boolean success = MapSettings.setIsolatedDiskCacheRootPath(diskCacheRoot, intentName);
          if (!success) {
              Toast.makeText(MainActivity.this, "diskcache", Toast.LENGTH_SHORT).show();
              // Setting the isolated disk cache was not successful, please check if the path is valid and
              // ensure that it does not match the default location
              // (getExternalStorageDirectory()/.here-maps).
              // Also, ensure the provided intent name does not match the default intent name.
          } else {
              mapFragment.init(new OnEngineInitListener() {
  
                  @Override
                  public void onEngineInitializationCompleted(Error error) {
                      Toast.makeText(MainActivity.this, "inside", Toast.LENGTH_SHORT).show();
                      if (error == Error.NONE) {
                          Toast.makeText(MainActivity.this, "inside 2", Toast.LENGTH_SHORT).show();
                          map = mapFragment.getMap();
                          map.setCenter(new GeoCoordinate(61.497961, 23.763606, 0.0), Map.Animation.NONE);
                          map.setZoomLevel(map.getMaxZoomLevel() - 1);
                          map.addTransformListener(MainActivity.this);
                          mPositioningManager = PositioningManager.getInstance();
                          mHereLocation = LocationDataSourceHERE.getInstance(
                                  new StatusListener() {
                                      @Override
                                      public void onOfflineModeChanged(boolean offline) {
                                          // called when offline mode changes
                                      }
  
                                      @Override
                                      public void onAirplaneModeEnabled() {
                                          // called when airplane mode is enabled
                                      }
  
                                      @Override
                                      public void onWifiScansDisabled() {
                                          // called when Wi-Fi scans are disabled
                                      }
  
                                      @Override
                                      public void onBluetoothDisabled() {
                                          // called when Bluetooth is disabled
                                      }
  
                                      @Override
                                      public void onCellDisabled() {
                                          // called when Cell radios are switch off
                                      }
  
                                      @Override
                                      public void onGnssLocationDisabled() {
                                          // called when GPS positioning is disabled
                                      }
  
                                      @Override
                                      public void onNetworkLocationDisabled() {
                                          // called when network positioning is disabled
                                      }
  
                                      @Override
                                      public void onServiceError(ServiceError serviceError) {
                                          // called on HERE service error
                                      }
  
                                      @Override
                                      public void onPositioningError(PositioningError positioningError) {
                                          // called when positioning fails
                                      }
                                  });
                          if (mHereLocation == null) {
                              Toast.makeText(MainActivity.this, "LocationDataSourceHERE.getInstance(): failed, exiting", Toast.LENGTH_LONG).show();
                              finish();
                          }
                          mPositioningManager.setDataSource(mHereLocation);
                          mPositioningManager.addListener(new WeakReference&lt;PositioningManager.OnPositionChangedListener&gt;(
                                  MainActivity.this));
                          // start position updates, accepting GPS, network or indoor positions
                          if (mPositioningManager.start(PositioningManager.LocationMethod.GPS_NETWORK_INDOOR)) {
                              mapFragment.getPositionIndicator().setVisible(true);
                          } else {
                              Toast.makeText(MainActivity.this, "PositioningManager.start: failed, exiting", Toast.LENGTH_LONG).show();
                              finish();
                          }
                      } else {
                          Log.d("xxxxxx", error.getDetails());
                          Log.d("xxxxxx", error.getStackTrace());
                          Toast.makeText(MainActivity.this, "onEngineInitializationCompleted: error: " + error + ", exiting", Toast.LENGTH_LONG).show();
                          finish();
                      }
                  }
              });
          }
      }
  // some more overriden methods and callback methods
  </code></pre>