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.
The following procedure uses Android Studio by way of example, you can also use other tools such as Gradle.
- Download and install Android Studio, if not already available on your development system.
- Make sure Android SDK build tools are installed. You’ll need to accept the licenses.
- Clone the Ably Asset Tracking SDK Android GitHub repo.
- Open the cloned directory in Android Studio.
- From the drop-down menu in Android Studio, select the app to run:
publishing-example-appand a device to run it on, then click Run.
The app builds and the emulator is displayed. It takes a while to boot up.
- By default the location source that the app will use for updates is set to phone. Using the Settings button in the app you can also select an Ably channel, or an S3 file as the source. The S3 file is a location history file downloaded from AWS S3 that replays the location data.
- Assuming you keep the default option, you can then create a simulated route in the Extended controls. In the emulator, use the Extended controls to create a route. This route is the simulated route that the publisher (asset) will follow.
- Start the route.
- In the publishing app click ‘+’ to add a trackable.
- Enter a tracking ID and click Add.
- Run the subscribing app on an additional device.
- Enter the tracking ID.
- The asset will be displayed on the map.
The following screenshot shows the example apps running: