Interface LocationManager.Code

All Superinterfaces:
CommonErrorConstant.Code
Enclosing interface:
LocationManager

public static interface LocationManager.Code extends CommonErrorConstant.Code
The error codes that the LocationManager can generate (all errors will be communicated through the LocationListener.onError(Error) callback).
  • Field Details

    • SERVICE_ALREADY_RUNNING

      static final int SERVICE_ALREADY_RUNNING
      The LocationManager is already running (positioning has started).

      Cause. You have called LocationManager.requestLocationUpdates() but the LocationManager was already running.

      Effect. This error does not have any side effect: positioning will keep running.

      Solution. You may use the method LocationManager.isRunning() to check if positioning is running before calling LocationManager.requestLocationUpdates(). You may also want to stop positioning LocationManager.removeUpdates() before starting it again.

      See Also:
    • MISSING_LOCATION_PERMISSION

      static final int MISSING_LOCATION_PERMISSION
      Android Location permissions are needed to scan BLE and/or Wi-FI, or to use GPS information.

      Cause. You want to access BLE, WiFi or GPS for positioning but you do not have the required "ACCESS_COARSE_LOCATION" or "ACCESS_FINE_LOCATION" permissions:

      • GPS requires the permission "ACCESS_FINE_LOCATION". GPS is only used in Global Mode (when LocationRequest.setBuildingIdentifier() has not been set).
      • BLE and WiFi require at least the permission "ACCESS_COARSE_LOCATION", but "ACCESS_FINE_LOCATION" will also do (since it has higher level). BLE and WiFi are always used (at least one of them), irregardless of whether Global or Building Mode is being used.

      Effect. Positioning can not start.

      Solution. You need to declare the required permissions in your AndroidManifest.xml file and also ask the user for them at runtime.

      In order to declare them in your AndroidManifest.xml file, add

      <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

      or

      <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

      In order to ask the user at runtime, you may use:

      ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},0);

      or

      ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},0);

      See Also:
    • LOCATION_DISABLED

      static final int LOCATION_DISABLED
      Android's Location must be enabled in the smartphone in order to scan Bluetooth and/or Wi-FI, or to use the GPS.

      Cause. You have attempted to start positioning but Android's Location is disabled in the smartphone. Android's Location should be enabled in order to access WiFi, BLE and/or GPS information.

      Effect. Positioning can not start.

      Solution. Enable Android's Location at the smartphone's system's tray or from the smartphone's settings.

      If are distributing your app, you may want your users to solve this issue for themselves. To do this, you may prompt a dialog in your app to inform users about the need to enable Android Location and direct them to the Location Settings menu of the smartphone (so they can enable it).

      You may do this by starting a new Activity as follows:

      startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));

      See Also:
    • BUILDING_NOT_CALIBRATED

      static final int BUILDING_NOT_CALIBRATED
      (Building Mode only) The building where you are trying to perform positioning is not calibrated.

      Cause. You have attempted to start positioning in a specific building (by setting LocationRequest.setBuildingIdentifier()), but this building does not have any active positioning model. This may be because the building has not been calibrated, or because all calibrations have been disabled.

      Effect. Positioning can not start.

      Solution.Calibrate the building or re-enable its calibrations.

      See Also:
    • BUILDING_MODEL_DOWNLOAD_ERROR

      static final int BUILDING_MODEL_DOWNLOAD_ERROR
      (Building Mode only) Could not download the positioning model of the building where you wanted to perform positioning.

      Cause. You have attempted to start positioning in a specific building (by setting LocationRequest.setBuildingIdentifier()). Situm SDK established connectivity with Situm Plaftorm and started downloading the building's positioning model. However, Situm SDK could not complete this download.

      In most cases, a bad network connectivity may cause this. This error provides an extra with LocationManager.PropertyKey.EXTRA_NETWORK_ERROR further describing the error.

      Effect. Positioning can not start.

      Solution. Ensure that your network connectivity is sufficient (at least 3G or equivalent speed and quality). Retry again later.

      See Also:
    • BUILDING_MODEL_PROCESSING_ERROR

      static final int BUILDING_MODEL_PROCESSING_ERROR
      An error occurred while processing the positioning model of a building where you are attempting to perform positioning.

      Cause. You have attempted to start positioning in a specific building (by setting LocationRequest.setBuildingIdentifier()). Situm SDK could download its positioning model successfully, but could not process its contents.

      This usually means that the positioning model file is corrupt. A less frequent cause is that your building model is old and the Situm SDK version you are using does not support it anymore.

      Effect. Positioning can not start.

      Solution. If the error is due to a corrupt file, you may try to clear the cache of the Situm SDK and/or of your application. If the error is due to an incompatibility between your old building model and a new version of Situm SDK, try to re-generate your model from Situm Dashboard Configuration screen.

      See Also:
    • BUILDING_NOT_FOUND

      static final int BUILDING_NOT_FOUND
      (Building Mode only) The building where you are trying to perform positioning does not exist or you don't have permissions to see it.

      Cause. You have attempted to start positioning in a specific building (by setting LocationRequest.setBuildingIdentifier()), but Situm SDK could not find this building in your account.

      Either the building does not exist (e.g. you provided a wrong building identifier) or you do not have permissions to see it.

      Effect. Positioning can not start.

      Solution. Lookup the building identifier in Situm Dashboard and make sure you are providing the right one. If this is not the cause, then your USER/API_KEY does the have sufficient permissions on this building. Contact your organization's account administrator.

      See Also:
    • USER_WITHOUT_BUILDINGS

      static final int USER_WITHOUT_BUILDINGS
      You do not have any buildings in your account or you don't have permissions to see any.

      Cause. You have attempted to start positioning in Global Mode (that is, without setting the LocationRequest.setBuildingIdentifier()), but Situm SDK could not find any building in your account. Either no building exists in your account, or you do not have permissions to see any. Global Mode requires at least one building, even if it is not calibrated.

      Effect. Global Mode positioning can not start.

      Solution. If your organization's account has buildings in it, make sure you have the appropriate permissions (contact your account's administrator if required). Otherwise, create at least 1 building in your account.

      See Also:
    • VISUAL_ODOMETRY_ERROR

      @Deprecated static final int VISUAL_ODOMETRY_ERROR
      Deprecated.
      This error is not used and will never be thrown
      See Also:
    • MISSING_BACKGROUND_LOCATION_PERMISSION

      @Deprecated static final int MISSING_BACKGROUND_LOCATION_PERMISSION
      Deprecated.
      This error is not used and will never be thrown.
      See Also:
    • START_SERVICE_FAILED

      static final int START_SERVICE_FAILED
      The LocationManager could not start because the Android Service where it runs tried to start in a illegal state.

      Cause. By default, the LocationManager runs as a Background Android Service to be able to run continuously in the background. A Background Android Service may fail to start for a number of reasons: most probably, the app was in the background when you called LocationManager.requestLocationUpdates() to start the LocationManager.

      Effect. Positioning will not start.

      Solution. Start the LocationManager only when the app is in the foreground. Alternatively, run the LocationManager as a Foreground Android Service (see LocationRequest.useForegroundService()).

      See Also:
    • CONFIGURATION_ERROR

      static final int CONFIGURATION_ERROR
      The configuration specified using the LocationRequest is illegal.

      Cause. You have provided a LocationRequest with an illegal parameter configuration . Currently, this is the list of illegal configurations:

      Take a look at the error description (Error.getMessage()) for more details.

      Effect. Positioning will not start.

      Solution. Provide a legal LocationRequest configuration.

      See Also:
    • MISSING_BLUETOOTH_PERMISSION

      static final int MISSING_BLUETOOTH_PERMISSION
      Missing required bluetooth permissions.

      Cause. You want to access BLE for positioning, but you do not have the runtime permissions BLUETOOTH_SCAN and BLUETOOTH_CONNECT.

      Android devices running API 31 and greater will require the runtime permissions BLUETOOTH_SCAN and BLUETOOTH_CONNECT if your app wants to use BLE to determine the position using nearby devices.

      In order to ask the user at runtime, you may use:

      ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT},0);

      See Also:
    • BLUETOOTH_DISABLED

      static final int BLUETOOTH_DISABLED
      Android's Bluetooth must be enabled in the smartphone in order to scan Bluetooth.

      Cause. You have attempted to start positioning with only BLE scanning but the Bluetooth is disabled in the smartphone.

      Effect. Positioning can not start.

      Solution. Enable Android's Bluetooth at the smartphone's system's tray or from the smartphone's settings.

      If are distributing your app, you may want your users to solve this issue for themselves. To do this, you may prompt a dialog in your app to inform users about the need to enable Android Bluetooth and direct them to the Bluetooth Settings menu of the smartphone (so they can enable it).

      You may do this by starting a new Activity as follows:

      startActivity(new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS));

      See Also:
    • FOREGROUND_SERVICE_NOT_ALLOWED

      static final int FOREGROUND_SERVICE_NOT_ALLOWED
      The LocationManager could not start because the Android Foreground Service where it runs tried to start in an illegal state.

      Cause: On Android 12+ (API level 31 and above), apps are generally restricted from starting Foreground Services while running in the background, except in certain specific exemptions. If you try to start the Situm Foreground Service from the background, the SDK will capture the Operating System exception and will throw this error.

      Effect. Positioning will not start.

      Solution. Start the LocationManager only when the app is in the foreground.

      See Also: