Check for Settings Errors
The application should call FairmaticSDK.getFairmaticSettings to get the list of errors that must be resolved.
FairmaticSDK.getFairmaticSettings().then((errors) => {
console.log('Setting Errors : ', errors);
});
Once all errors and warnings are resolved, Leeo SDK will send an onSettingsChanged callback with both errorsFound and warningsFound set to false that signals that the SDK has resumed functioning correctly.
The following snippets demonstrate one way of handling this event:
FairmaticSDK.getFairmaticSettings().then((errors) => {
if (errors) {
// handle errors, show in UI, and resolve them
errors.forEach((err) => {
switch (err) {
case "location-permission-denied":
break;
case "notifications-disabled":
break;
default:
console.log('Error: ', err);
break;
// Handle other error types as needed
}
});
} else {
// If the SDK is not set up, this value is null/undefined
}
});
getFairmaticSettings returns an array of FairmaticSettingError enum type. It reports following errors that may affect the normal functioning of SDK. Try addressing them or contact support if the issue persists
| Error | Platform | Description |
|---|---|---|
| background-restriction-enabled | Android | User has enabled background restrictions on the application. |
| location-permission-denied | Android, iOS | User has denied location permission to the application. |
| activity-recognition-permission-denied | Android, iOS | User has denied activity recognition permission to the application. On iOS, this error is returned when the user has denied "Motion & Fitness" permission. |
| battery-optimization-enabled | Android | Battery optimization is enabled. This can happen when: 1. Device specific Adaptive battery is turned on and the app is not exempted from this setting. 2. User has explicitly turned on Battery Optimization for the app. This will be shown as an error on Samsung devices only. For more details, see: Optimize for Doze and App Standby |
| notifications-disabled | Android | User has disabled the app notifications or denied the notification permission |
| google-play-services-version | Android | Google Play Services version is incompatible with Leeo SDK |
| internal-error | Android | Internal SDK error. Please contact support |
| location-accuracy-authorization-reduced | iOS | Device location accuracy reduced. |
| precise-location-denied | Android | This will be returned on devices running on Android 12 and above when the user has set the location accuracy for the application as "Approximate" (which provides the location access accuracy corresponding to Manifest.permission.ACCESS_COARSE_LOCATION). Leeo SDK needs the location access accuracy for the application to be set as "Precise" (which provides the location accuracy corresponding to Manifest.permission.ACCESS_FINE_LOCATION) to operate. Hence, it is recommended to not manually downgrade the location access accuracy. |
| location-service-off | iOS | The location service of the device is turned off. The user should be prompted to turn on the location service by your app when this error is returned. |
| location-mode-high-accuracy-denied | Android | This will be returned on devices running on Android versions 4.4 to 8.1 when user has not set location mode as LOCATION_MODE_HIGH_ACCURACY. |