Android – Error handling

Several types of errors can be delivered to the onBlueDotPointServiceError callback of ServiceStatusListener:

A fatal error (where isFatal returns true) is an indication that a critical error has occurred, and BlueDotPointService is no longer functioning. The invocation of onBlueDotPointServiceStop follows the delivery of a fatal error.

The getReason interface provides human-readable information about the cause of an error, which is useful for troubleshooting the problem. The following table provides assistance in tracking and resolving common errors:

Error Fatal / Non-fatal Reason Corrective action
BDAuthenticationError  Fatal No credentials provided

Authentication Failed: Username does not exist

Authentication Denied: Could not locate a valid application for the given API key and package Name

 Provide valid authentication credentials.
BDAuthenticationError  Fatal Exception: SSLHandshakeException Security policies need to be updated. Refer to the relevant Google documentation here.
BDAuthenticationError  Fatal Network is not available
Exception: SSLException
Ensure network and data connection are available on the mobile device.
LocationPermissionNotGrantedError  Fatal Permissions to use location services are not granted. Please check and request for location services permission, before authentication. Follow the Marshmallow permissions model and check if required permissions have been granted before invoking the BlueDotPointService. Refer to the relevant Google documentation here.
LocationServiceNotEnabledError Fatal Location services are not available due to no valid Location Provider on device The device does not support the location provider requested by the SDK.
 LocationServiceNotEnabledError Non-fatal Location Services must be enabled to provide full functionality. Please enable both GPS and network location. Location services must be enabled in High mode for the BlueDotPointService to function.

The application must handle this error appropriately notifying the user to re-enable Location Services in High Accuracy mode (both GPS and Network). Bluedot SDK continues to function in the background waiting for Location Services to be re-enabled.

 LocationServiceNotEnabledError Non-fatal Both WiFi and ScanAlwaysAvailable are disabled. It is recommended to enable WiFi or ScanAlwaysAvailable to improve location accuracy. Switch on WiFi or ScanAlwaysAvailable in the device settings to improve accuracy.

ScanAlwaysAvailable was introduced in Android Lollipop and can be found as follows:

  • Settings -> WiFi -> Advanced (Lollipop)
  • Settings -> Location -> Menu -> Scanning (Marshmallow)
  • Settings -> Location -> Improve Accuracy (Marshmallow Samsung)
 ForegroundNotificationNotSetError  Fatal Starting from Android O, Location Services are restricted from working in the background. It is necessary to set Foreground Notifications to trigger in the background (foreground will trigger as usual). Use the  ServiceManager.setForegroundServiceNotification API to set the Foreground Service Notification, which will be popped if SDK is running on Android O and above.
 RuleDownloadError Non-fatal Exception: CalledFromWrongThreadException Avoid performing UI operations from ServiceStatusListenercallbacks as they can be invoked from a different threading context. Use Android’s standard runOnUiThread instead.
 RuleDownloadError Non-fatal Network is not available

Exception: SSLException

Ensure network and data connection are available on the mobile device.
RuleDownloadError Non-fatal SDK version mismatch. Please contact Bluedot Support if the error persists. The Bluedot Point Access backend is responding to the SDK with an unknown format of Ruleset data. Bluedot Support should be contacted if this issue persists.
 BLENotAvailableError Non-fatal BLE is not available Beacon-based triggering will not be possible on this particular device.
 BluetoothNotEnabledError Non-fatal There are nearby Beacons which cannot be detected because Bluetooth is disabled. Re-enable Bluetooth to restore full functionality. Enable Bluetooth in the device settings to enable Beacon-based triggering.
Created by Bluedot DevOps on June 19, 2018