disableLocationAuthorizationAlert property
Disables automatic authorization alert when plugin detects the user has disabled location authorization.
You will be responsible for handling disabled location authorization by listening to the BackgroundGeolocation.onProviderChange event.
By default, the plugin automatically shows a native alert to the user when location-services are disabled, directing them to the settings screen. If you do not desire this automated behavior, set disableLocationAuthorizationAlert: true
.
iOS
The iOS alert dialog text elements can be configured via locationAuthorizationAlert and locationAuthorizationRequest
Android
Android can detect when the user has configured the device's Settings->Location in a manner that does not match your location request (eg: Config.desiredAccuracy. For example, if the user configures Settings->Location->Mode with Battery Saving (ie: Wifi only) but you've specifically requested DESIRED_ACCURACY_HIGH (ie: GPS), Android will show a dialog asking the user to confirm the desired changes. If the user clicks [OK]
, the OS will automcatically modify the Device settings.
This automated Android dialog will be shown in the following cases:
- BackgroundGeolocation.onProviderChange
- BackgroundGeolocation.start
- BackgroundGeolocation.requestPermission
Example
BackgroundGeolocation.onProviderChange((ProviderChangeEvent event) {
print('[onProviderChange] ${event}');
if (!provider.enabled) {
alert('Please enable location services');
}
});
BackgroundGeolocation.ready(Config(
disableLocationAuthorizationAlert: true
));
Implementation
bool? disableLocationAuthorizationAlert;