HERE Android SDK Developer's Guide

Requesting Android Permissions

If your application supports Android 6.0 or above, add the following code in your activity file to ask the application users to grant Android permissions at runtime. For more information about this requirement, see the Android Developer documentation.

Figure 1. Request Location Permission
Figure 2. Request File Access Permission
  1. Add the following import statements to the beginning of the file:
    import android.Manifest;
    import android.widget.Toast;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.List;
  2. Add these static variables to the BasicMapActivity class:
     * permissions request code
    private final static int REQUEST_CODE_ASK_PERMISSIONS = 1;
     * Permissions that need to be explicitly requested from end user.
    private static final String[] REQUIRED_SDK_PERMISSIONS = new String[] {
        Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE };
    Note: The Android permission android.permission.ACCESS_FINE_LOCATION is not required to initialize or use the SDK. However, it is required if you use the following components:
    • PositioningManager
    • NavigationManager
    • PositionSimulator
    • LiveSight
  3. Add the following methods to the BasicMapActivity class:
     * Checks the dynamically-controlled permissions and requests missing permissions from end user.
    protected void checkPermissions() {
      final List<String> missingPermissions = new ArrayList<String>();
      // check all required dynamic permissions
      for (final String permission : REQUIRED_SDK_PERMISSIONS) {
        final int result = ContextCompat.checkSelfPermission(this, permission);
        if (result != PackageManager.PERMISSION_GRANTED) {
      if (!missingPermissions.isEmpty()) {
        // request all missing permissions
        final String[] permissions = missingPermissions
            .toArray(new String[missingPermissions.size()]);
        ActivityCompat.requestPermissions(this, permissions, REQUEST_CODE_ASK_PERMISSIONS);
      } else {
        final int[] grantResults = new int[REQUIRED_SDK_PERMISSIONS.length];
        Arrays.fill(grantResults, PackageManager.PERMISSION_GRANTED);
    public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
        @NonNull int[] grantResults) {
      switch (requestCode) {
          for (int index = permissions.length - 1; index >= 0; --index) {
            if (grantResults[index] != PackageManager.PERMISSION_GRANTED) {
              // exit the app if one permission is not granted
              Toast.makeText(this, "Required permission '" + permissions[index]
                  + "' not granted, exiting", Toast.LENGTH_LONG).show();
          // all permissions were granted
  4. Finally, change the method call in onCreate(Bundle) from initialize() to checkPermissions() instead:
    public void onCreate(Bundle savedInstanceState) {

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