url property

String? url
getter/setter pair

Your server url where you wish to POST locations to.

Both the iOS and Android native code host their own robust HTTP service which can automatically upload recorded locations to your server. This is particularly important on Android when running "Headless" configured with stopOnTerminate:false, since only the plugin's background-service is running in this state.

BackgroundGeolocation.ready(Config(
  url: 'https://my-server.com/locations',
  params: {
    "user_id": 1234
  },
  headers: {
    "Authorization": "Basic my-secret-key"
  },
  autoSync: true,
  httpMethod: 'POST'
));

See also: HTTP Guide at HttpEvent.

WARNING: It is highly recommended to let the plugin manage uploading locations to your server, particularly for Android when configured with stopOnTerminate: false, since your App Component will terminate — only the plugin's native Android background service will continue to operate, recording locations and uploading to your server. The plugin's native HTTP service is better at this task than your own http requests, since the SDK will automatically retry on server failure.

Implementation

String? url;