What you will learn

This tutorial will teach you how the mobile SDK can help you to manage the location permission.

Prerequisites - What you need to get started

  • Your SDK credentials, including an SDK ID and SDK Key on HEROW to initialize the SDK.
  • A zone, which has been configured on your herow account.
  • An Android Device, with Android 4.0 and above.
  • The Android Studio application, which you can download from the Android Developers website.

About location permission

Android 6 introduces a new set of permissions for specific features, which must be explicitly granted by the user upon first launch. This is the case when an application wants to access the location of a user. The Bluetooth scanning process has been associated with the location feature, including GPS and Wi-Fi network triangulation.

If your application targets Android 6 devices or above, and does not ask for location permission, the bluetooth scanning process cannot start.

If your application does not target Android 6 devices or above, you do not need to implement this feature, but the bluetooth scanning process won't return result when the application is in background on Android 6 devices or above.

Requesting location permission

Find out more about location permission in the official Android permission tutorial.

The SDK simplifies you the location permission request with 3 methods from the HerowInitializer:

  • addPermissionToAsk(permissionName): To ask a permission when an Activity starts.
    • can be called before any Activities start
  • askPermissions(permissionNames): To ask immediatly the permission, if the permission has never been requested before
    • must be called once an Activity starts
  • checkPermissionStatus(Activity, permissionName): To known the permission status - never requested, denied, or granted.
    • must be called once an Activity starts
    • returns a PermissionStatus, an ‘enum’ with the following states:
      • NEVER_REQUESTED: the permission has never been requested
      • ALREADY_REQUESTED_BUT_DENIED: the user denies the permission
      • GRANTED: the user grants the permission
  PermissionStatus status = herowInitializer.checkPermissionStatus(Manifest.permission.ACCESS_FINE_LOCATION);


It is necessary to have an Android device with Android 6 or above to test these methods.


It is not mandatory to use these methods.

You can still manage the location permission request in your own way.

There are also several dedicated libraries to help you with the permission request management. E.g. EasyPermissions.