Using the example apps
Asset Tracking SDK repositories provide example apps for subscribing and publishing. You can test out the sample apps using the emulator provided with the developer tools for your platform.
Using the example apps
Copied!
The JavaScript example app only supports the Subscribing SDK. To use it, you must first run one of the publishing example apps to generate location data.
- Clone the Ably Asset Tracking SDK JavaScript GitHub repo.
- In the root directory of the project, install the SDK dependencies:
npm install
CopyCopied!
- Then, build the SDK:
yarn build
CopyCopied!
- Change into the
examples/subscribing-example-app
directory and install the example app’s dependencies:
npm install
CopyCopied!
- Create a
.env
file in the root of the example app and configure it with your Ably API key:
ABLY_API_KEY=your-api-key <br>
CopyCopied!
- Open your browser and visit
http://localhost:5000
:
- Select your preferred map provider (Google Maps or Mapbox) and enter your provider’s API key when prompted.
- Enter the ID of the asset you want to track:
- The example app receives updates from the publisher and shows the current location of the asset on the map:
See also
Copied!