setLocation static method
Implementation
@Deprecated('Use setUserLocation instead')
static Future<String?> setLocation(String latitude, String longitude) async {
if (!_instance._countlyState.isInitialized) {
String message = '"initWithConfig" must be called before "setLocation"';
log('setLocation, $message', logLevel: LogLevel.ERROR);
return message;
}
log('Calling "setLocationInit" with latitude:[$latitude], longitude:[$longitude]');
log('setLocation is deprecated, use setUserLocation instead', logLevel: LogLevel.WARNING);
if (latitude.isEmpty) {
String error = 'setLocation, latitude cannot be empty';
log(error);
return 'Error : $error';
}
if (longitude.isEmpty) {
String error = 'setLocation, longitude cannot be empty';
log(error);
return 'Error : $error';
}
final String? result = await setUserLocation(gpsCoordinates: '$latitude,$longitude');
return result;
}