react-native-background-geolocation@5.0.0-beta.1
    Preparing search index...

    Interface TransistorAuthorizationService

    Transistor Software hosts a demo server at tracker.transistorsoft.com which is designed to consume location data from devices running the Background Geolocation SDK.

    You may also run your own instance of Demo Server locally. See background-geolocation-console

    The test server is a great way to debug location problems or evalute the SDK's behaviour, since the results can easily be shared with Transistor Software when requesting support.

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

    // Fetch an authoriztion token from server. The SDK will cache the received token.
    const token = await
    BackgroundGeolocation.findOrCreateTransistorAuthorizationToken(orgname, username, url);

    BackgroundGeolocation.ready({
    transistorAuthorizationToken: token
    })

    Viewing Your Tracking Results

    To view your tracking results in the browser, use your configured "Organization Name" and visit:

    http://tracker.transistorsoft.com/my-organization-name

    interface TransistorAuthorizationService {
        findOrCreate(
            orgName: string,
            username: string,
            url?: string,
        ): Promise<TransistorAuthorizationToken>;
        destroy(url?: string): Promise<void>;
        applyIf<
            T extends
                Config & {
                    transistorAuthorizationToken?: TransistorAuthorizationToken;
                },
        >(
            config: T,
        ): Config;
    }
    Index

    Methods

    • Find or create a token for the given organization and username.

      Parameters

      • orgName: string

        Organization / company identifier.

      • username: string

        Username or device label.

      • Optionalurl: string

        Optional tracker base URL. Defaults to the SDK's built‑in value.

      Returns Promise<TransistorAuthorizationToken>

      A Promise resolving with a TransistorAuthorizationToken instance.

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

      // Fetch an authoriztion token from server. The SDK will cache the received token.
      const token = await
      BackgroundGeolocation.findOrCreateTransistorAuthorizationToken(orgname, username, url);

      BackgroundGeolocation.ready({
      transistorAuthorizationToken: token
      })
    • Destroy the token associated with the given tracker base URL.

      Parameters

      • Optionalurl: string

        Tracker base URL. Defaults to the SDK's built‑in value.

      Returns Promise<void>

    • Mutates a Config to apply the given Transistor token if present.

      The JS implementation typically:

      • Reads config.transistorAuthorizationToken
      • Deletes that property
      • Sets config.http.url or config.url to "<token.url>/api/locations"
      • Sets config.authorization = { strategy: "jwt", ... }

      If no transistorAuthorizationToken is found, the config is returned unchanged.

      Type Parameters

      Parameters

      • config: T

        A config that may contain a transistorAuthorizationToken field.

      Returns Config

      A Config with HTTP + authorization wired to the token, if present.

      async function applyDemoToken(
      service: TransistorAuthorizationService,
      config: Config
      ): Promise<Config> {
      const token = await service.findOrCreate('my-org', 'user@example.com');

      return service.applyIf({
      ...config,
      transistorAuthorizationToken: token
      });
      }