Asset Tracking (Android SDK)

This article describes how to implement asset tracking using the Android SDK.

Asset Tracking

Asset Tracking is a feature that uses Aruba Tags hardware to track valuable locations on a map. You can use the SDK to get Tag location updates and render Tag locations on a map.

Get Tag Updates

Before you can get Tag updates, you'll need to create an instance of Asset Tracking's main class, TagStream.

First, create your own instance of TagStream using its Builder:

    tagStream = new TagStream.Builder()
                            .setMapKey(yourMapKeyHere)
                            .setListener(this)
                            .build();

With the TagStream instance created, call the following method to get updates on your tagged assets:

    tagStream.startUpdatingTags();

To stop getting updates:

    tagStream.stopUpdatingTags();

The TagStream builder class takes a listener that will be used to pass information about Tags to your code. The listener must implement two methods:

    void onTagsUpdated(List
 
   tags);
    void onTagsRemoved(List
  
    tags); 
  
 

The first method will be called when we get information about new Tags or when existing Tags are updated. This list of Tags will contain all Tags.

The second method will get called when a Tag is removed. This list of Tags will contain the deleted Tags.

To dispose of the TagStream (SDK 4.6.0+):

    tagStream.dispose();

Render Tags on the Map

Use the marker TagMarker to render your Tags on a map. It will show a generic asset icon. Create a marker in the following way:

    tagMarker = new TagMarker(getContext(), tag);

The marker gets the name and position of the marker from the tag object. At that point, you can add it to your map.

You can find working examples of this in the Samples app with TagsFragment and SingleTagFrament.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.