transistorAuthorizationToken property

TransistorAuthorizationToken? transistorAuthorizationToken
getter/setter pair

Convenience option to automatically configures the SDK to upload locations to the Transistor Software demo server at http://tracker.transistorsoft.com (or your own local instance of background-geolocation-console)

See TransistorAuthorizationToken. This option will automatically configures the url to point at the Demo server as well as well as the required Authorization configuration.

Example

TransistorAuthorizationToken token = await
  TransistorAuthorizationToken.findOrCreate('my-company-name', 'my-username');

BackgroundGeolocation.ready(Config(
  transistorAuthorizationToken: token
));

This convenience option merely performs the following Authorization configuration automatically for you:

// Base url to Transistor Demo Server.
const String url = 'http://tracker.transistorsoft.com';

// Register for an authorization token from server.
TransistorAuthorizationToken token = await
  TransistorAuthorizationToken.findOrCreate('my-company-name', 'my-username');

BackgroundGeolocation.ready(Config(
  url: "$url/api/locations",
  authorization: Authorization(
    strategy: "JWT",
    accessToken: token.accessToken,
    refreshToken: token.refreshToken,
    refreshUrl: "$url/api/refresh_token",
    refreshPayload: {
      "refresh_token": "{refreshToken}"
    },
    expires: token.expires
  )
));

Implementation

TransistorAuthorizationToken? transistorAuthorizationToken;