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 AppConfig.stopOnTerminate:false, since only the plugin's background-service is running in this state.

// Listen to http events.
BackkgroundGeolocation.onHttp((HttpEvent event) {
  print("[onHttp] $event");
});

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

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.

See the HTTP Guide at HttpConfig for end‑to‑end examples, error handling, and payload structure.

Implementation

String? url;