startLocationService static method
Future
startLocationService({
- bool startOnBoot = false,
- int interval = 1000,
- int fastestInterval = 500,
- double distanceFilter = 0.0,
- bool forceAndroidLocationManager = false,
- LocationPriority priority = LocationPriority.priorityHighAccuracy,
- LocationCallback? backgroundCallback,
Start receiving location updated
Implementation
static Future<dynamic> startLocationService({
bool startOnBoot = false,
int interval = 1000,
int fastestInterval = 500,
double distanceFilter = 0.0,
bool forceAndroidLocationManager = false,
LocationPriority priority = LocationPriority.priorityHighAccuracy,
LocationCallback? backgroundCallback,
}) async {
var callbackHandle = 0;
var locationCallback = 0;
if (backgroundCallback != null) {
callbackHandle = PluginUtilities.getCallbackHandle(callbackHandler)!.toRawHandle();
try {
locationCallback =
PluginUtilities.getCallbackHandle(backgroundCallback)!
.toRawHandle();
} catch (ex, stack) {
log('Error getting callback handle', error: ex, stackTrace: stack);
}
}
return await _channel
.invokeMethod('start_location_service', <String, dynamic>{
'callbackHandle': callbackHandle,
'locationCallback': locationCallback,
'startOnBoot': startOnBoot,
'interval': interval,
'fastest_interval': fastestInterval,
'priority': priority.index,
'distance_filter': distanceFilter,
'force_location_manager': forceAndroidLocationManager,
});
}