Skip to content

TransistorAuthorizationService

export interface TransistorAuthorizationService {

Client for the Transistor Software demo tracking server.

Transistor Software hosts a public demo server at tracker.transistorsoft.com that consumes location data from devices running the Background Geolocation SDK. You can also run a local instance — see background-geolocation-console.

The demo server is useful for evaluating the SDK or for sharing tracking results with Transistor Support when debugging.

Viewing results

To view tracking results in a browser, visit:

http://tracker.transistorsoft.com/<your-organization-name>

const url = "http://tracker.transistorsoft.com";
const orgname = "my-company-name";
const username = "my-username";

// Fetch a token from the server (the SDK caches it automatically).
const token = await BackgroundGeolocation.findOrCreateTransistorAuthorizationToken(
  orgname, username, url
);

BackgroundGeolocation.ready({
  transistorAuthorizationToken: token
});

Members

applyIf

applyIf(config: T):Config;

Mutate a Config to apply a transistorAuthorizationToken if present.

The implementation reads config.transistorAuthorizationToken, removes that property, sets config.http.url to "<token.url>/api/locations", and injects config.authorization with a JWT strategy derived from the token. If no transistorAuthorizationToken is found, the config is returned unchanged.

const token = await service.findOrCreate('my-org', 'user@example.com');

const config = service.applyIf({
  ...myConfig,
  transistorAuthorizationToken: token
});

BackgroundGeolocation.ready(config);

destroy

destroy(url?: string): Promise<void>;

Remove the cached token associated with the given tracker URL.

findOrCreate

findOrCreate(orgName: string, username: string, url?: string): Promise<TransistorAuthorizationToken>;

Find or create an authorization token for the given organization and username.

If a token already exists in the local cache for this orgName + url combination, the cached token is returned. Otherwise a new token is requested from the server and cached for future calls.

const token = await BackgroundGeolocation.findOrCreateTransistorAuthorizationToken(
  "my-company-name",
  "my-username",
  "http://tracker.transistorsoft.com"
);

BackgroundGeolocation.ready({
  transistorAuthorizationToken: token
});