Interface LocationManager.Code
-
- All Superinterfaces:
CommonErrorConstant.Code
- Enclosing interface:
- LocationManager
public static interface LocationManager.Code extends CommonErrorConstant.Code
The error codes that theLocationManager
can generate (all errors will be communicated through theLocationListener.onError(Error)
callback).
-
-
Field Summary
Fields Modifier and Type Field Description static int
BLUETOOTH_DISABLED
Android's Bluetooth must be enabled in the smartphone in order to scan Bluetooth.static int
BUILDING_MODEL_DOWNLOAD_ERROR
(Building Mode only) Could not download the positioning model of the building where you wanted to perform positioning.static int
BUILDING_MODEL_PROCESSING_ERROR
An error occurred while processing the positioning model of a building where you are attempting to perform positioning.static int
BUILDING_NOT_CALIBRATED
(Building Mode only) The building where you are trying to perform positioning is not calibrated.static 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.static int
CONFIGURATION_ERROR
The configuration specified using theLocationRequest
is illegal.static 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.static int
MISSING_BACKGROUND_LOCATION_PERMISSION
Deprecated.This error is not used and will never be thrown.static int
MISSING_BLUETOOTH_PERMISSION
Missing required bluetooth permissions.static int
MISSING_LOCATION_PERMISSION
Android Location permissions are needed to scan BLE and/or Wi-FI, or to use GPS information.static int
SERVICE_ALREADY_RUNNING
TheLocationManager
is already running (positioning has started).static int
START_SERVICE_FAILED
TheLocationManager
could not start because the Android Service where it runs tried to start in a illegal state.static int
USER_WITHOUT_BUILDINGS
You do not have any buildings in your account or you don't have permissions to see any.static int
VISUAL_ODOMETRY_ERROR
Deprecated.This error is not used and will never be thrown-
Fields inherited from interface es.situm.sdk.error.CommonErrorConstant.Code
INTERNAL_ERROR, INTERNET_NOT_AVAILABLE, UNPROCESSABLE_ENTITY
-
-
-
-
Field Detail
-
SERVICE_ALREADY_RUNNING
static final int SERVICE_ALREADY_RUNNING
TheLocationManager
is already running (positioning has started).Cause. You have called
LocationManager.requestLocationUpdates()
but theLocationManager
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 callingLocationManager.requestLocationUpdates()
. You may also want to stop positioningLocationManager.removeUpdates()
before starting it again.- See Also:
- Constant Field Values
-
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:
- Constant Field Values
- GPS requires the permission "ACCESS_FINE_LOCATION". GPS is only used in Global Mode (when
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
VISUAL_ODOMETRY_ERROR
@Deprecated static final int VISUAL_ODOMETRY_ERROR
Deprecated.This error is not used and will never be thrown- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
START_SERVICE_FAILED
static final int START_SERVICE_FAILED
TheLocationManager
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 calledLocationManager.requestLocationUpdates()
to start theLocationManager
.Effect. Positioning will not start.
Solution. Start the
LocationManager
only when the app is in the foreground. Alternatively, run theLocationManager
as a Foreground Android Service (seeLocationRequest.useForegroundService()
).- See Also:
- Constant Field Values
-
CONFIGURATION_ERROR
static final int CONFIGURATION_ERROR
The configuration specified using theLocationRequest
is illegal.Cause. You have provided a LocationRequest with an illegal parameter configuration . Currently, this is the list of illegal configurations:
- WiFi or BLE required. You have set
LocationRequest.useWifi()
andLocationRequest.useBle()
to false. At least one of them must be true.
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:
- Constant Field Values
- WiFi or BLE required. You have set
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
-