Telematics SDK | Developer portal
  • Get started
  • 4 Steps to Integrate SDK
  • Product Wiki
  • License
  • FAQ
  • PRODUCT DESCRIPTION
    • How it works
    • SDK Features
    • Scoring
      • Risk driving Scoring
        • Event detection
        • Trip rating
        • Overall scoring
      • Eco Scoring
    • Dataset
      • Dataset | User statistics API
      • Data samples
        • Summary - Processed track details (Rich track details)
        • Processed track waypoints (Rich track points)
        • Summary - list of Processed tracks
        • Incoming track events
        • Incoming track points (waypoints)
        • Summary - list of Incoming tracks
      • Dataset Decription
        • Bluetooth OBD - Vehicle Dataset
        • LastKnownPoints
        • IncomingTrackPoints
        • IncomingTrackEvents
        • Enriched telematics data
          • RichTracks
          • RichTrackPoints
          • RichTrackEvents
          • RichTrackDetails
          • UserStatisticDrivingDetails
        • Raw telematics data from SDK
    • Reporting
      • Drivecoins summary
      • Trip summary
      • Scoring summary
      • User state
      • Fraud
      • Trip waypoints
      • Trip events
    • External Articles
      • Why mobile telematics hits hardware telematics
  • Step 1: Create Datahub Account
  • Step 2: SDK Installation
    • Get started
    • iOS SDK installation
      • *Set up Your Development Environment
      • *Configure Your Project
      • *App Delegate
      • *Configure Framework
      • *React Native Installation
        • Create the iOS bridge
      • Add list of trips to your ViewController
      • Add statistics data to your ViewController
      • *What’s different in iOS 13?
      • *iOS 13 Permissions Wizard
      • *SDK Enable \ Disable \ Disable With Upload
      • *Incoming Tags
      • *Tracking Status
      • *SDK Delegates
      • *SDK Modes
      • *Using the Debugging Tools in Simulator
    • Android SDK installation
      • *Getting started
        • *Set up Your Development Environment
        • *Setup and enable SDK
        • *Permissions wizard
        • *Permissions dialog
        • *Configure SDK variables for notifications
      • *Subscribe to tracking events
      • *Incoming tags managing
      • *Migration from SDK v1.6.x to SDK v2.0.x
    • *Check SDK Installation
      • iOS Simulator
      • DataTool
      • ZenRoad
    • *Demo Applications
      • iOS | Open Source Demo Application
      • iOS | SDK Demo Application
      • iOS | Swift | SDK Demo Application
      • Android | SDK Demo Application
      • Android | Java | SDK Demo Application
      • Flutter | SDK Demo Application
    • SDK Changelog
      • Android SDK Changelog
      • iOS SDK Changelog
    • Permissions Guides
      • First Launch
        • iOS 13 (and higher) Permissions Guide
        • iOS 12 (and lower) Permissions Guide
        • Android 9 Permissions Guide
        • Android 9 XIaomi Permissions Guide
        • Android 10 Permissions Guide
      • *Troubleshooting
        • iOS — Troubleshooting
          • iOS — Troubleshooting
        • Android — Troubleshooting
          • Samsung — Troubleshooting
          • Oppo — Troubleshooting
          • Huawei — Troubleshooting
          • Xiaomi — Troubleshotting
          • OnePlus — Troubleshooting
          • Meizu — Troubleshooting
          • Asus — Troubleshooting
          • Vivo — Troubleshooting
          • Wiko — Troubleshooting
  • Step 3: Register SDK users
    • User Registration (API)
  • Step 4: API | User Statistics, Scores, Trips
    • Step 4: Get Statistics, Scorings and Trip Data
    • API Authorization
    • Statistics and Scoring APIs
      • Get started - Statistics and Scoring API
      • User | Individual Scorings and Statistics
      • Admin | User(s) - Scorings and Statistics
      • Admin | Consolidated Scorings and Statistics
    • Trips API
      • Get a short list of tracks
      • Get a list of tracks with paging
      • Get a list of tracks by IDs
      • Get a single track with waypoints
      • Get the most earliest track
      • Track Statuses
  • SDK Features
    • *Bluetooth Device - Get started
      • *Get Started
      • *Android - ELM API
      • *iOS - ELM API
    • Trip Tags - Get started
      • Tags for trips via mobile app
        • Android - Tags for trips
        • iOS - Tags for trips
      • Tags for period
      • Trip log by tags
  • PLATFORM FEATURES
    • *User Management
      • *User Registration
      • *Check User Existence
      • *User Management
    • *Vehicle Management
      • *Directories
      • *Vehicles
    • FNOL, Inspections & Damage Recognition
      • Get started
      • Profiles
      • Claims
      • Vehicle inspections
        • Dictionary of vehicle photos
      • Photo processing
    • *Leaderboard
      • *Summary Leaderboard
      • *Leaderboard by factors
      • Swagger - Leaderboard
    • *Streaks
    • *SNS
      • *How to register AWS SNS
    • 3rd party data processing
      • Swagger - Incoming getaway
    • *User & Permissions Status | Heartbeats
  • Other
    • Response Codes
    • Resources swaggers
      • Swagger: User service
      • Swagger: Scorings and Statistics API
      • Swagger: Telematics data
      • Swagger: Leaderboard
      • Swagger: Vehicle Management
      • Driving details
      • Swagger: FNOL, Inspections & Damage Recognition
      • Swagger: Heartbeats
    • Archive
      • Get started
      • Statistics and Scorings API
      • Step 5: Get statistics and trip data [ARCHIVED]
      • User Statistics API [Archived]
      • SDK - Statistics API [ARCHIVED]
        • Get the data to the Android app
          • Android Telematics data (Tracks)
            • Check current running track state
            • Get start date for current recording trip
            • Register tracking state listener (for onStartTracking/onStopTracking events)
            • Register speed violations listener
            • Get flag for registered speed violations listener
            • Get registered speed limit in km/h or default
            • Get registered speed violations timeout in ms or default
            • Get Tracks
            • Get detailed trips information
            • Get available user roles
            • Change a user role (any of TrackOriginDictionary.code)
          • Android User Statistics
            • Get Dashboard info
            • Get detailed Dashboard
            • Get Driving time statistics
            • Get Speeding statistics
            • Get Mileage statistics
            • Get Distracted Phone Usage statistics
        • Get the data to the iOS app
          • Other methods
          • iOS Telematics data (tracks)
            • Request all Tracks with specified offset and limit
            • Request all Tracks with specified offset and limit. No filter will be used in request
            • Request Track info with specified Track Token
            • Request Track origins dictionary
            • Change Track Origin Code
            • Share Track
          • iOS User Statistics
            • Get shared Track
            • Request main statistics data for all possible statistic types
            • NS_ENUM
            • Request main statistics data for all possible statistic types
            • Properties and Protocols
      • Get all DeviceTokens
    • Report a bug
    • Data Hub
    • Talk to sales
  • Postman collection
Powered by GitBook
On this page
  • TagsProcessingListener
  • Tags processing receiver

Was this helpful?

  1. Step 2: SDK Installation
  2. Android SDK installation

*Incoming tags managing

Available since v2.2.243

In 2.2.243 version of the SDK incoming tags processing was added. It supports both online and offline modes. All tags will be uploaded with the specified time when they were made.

Methods doesn’t return any data. You can register a TagsProcessingListener or TagsProcessingReceiver (it is a BroadcastReceiver you have to implement on your side and register with the SDK) for subscribing to tags processing updates.

Methods for managing:

    /**
	 * Get tags
	 *
	 * The result of the operation you can get through the registration of [TagsProcessingListener] or [TagsProcessingReceiver].
	 * Check [registerTagsReceiver] and [addTagsProcessingCallback]
	 *
	 * @throws IllegalStateException if [initialize] never called. See also [isInitialized].
	 */
	fun getFutureTrackTags()

    /**
	 * Create new tag
	 *
	 * The result of the operation you can get through the registration of [TagsProcessingListener] or [TagsProcessingReceiver].
	 * Check [registerTagsReceiver] and [addTagsProcessingCallback]
	 * @param tag tag's name
	 * @param source source of the tag. Optional parameter
	 *
	 * @throws IllegalStateException if [initialize] never called. See also [isInitialized].
	 */
	fun addFutureTrackTag(tag: String?, source: String? = null)

    /**
	 * Remove specified tag
	 *
	 * The result of the operation you can get through the registration of [TagsProcessingListener] or [TagsProcessingReceiver].
	 * Check [registerTagsReceiver] and [addTagsProcessingCallback]
	 * @param tag tag's name
	 *
	 * @throws IllegalStateException if [initialize] never called. See also [isInitialized].
	 */
	fun removeFutureTrackTag(tag: String?)
	
	/**
	 * Remove all tags.
	 *
	 * The result of the operation you can get through the registration of [TagsProcessingListener] or [TagsProcessingReceiver].
	 * Check [registerTagsReceiver] and [addTagsProcessingCallback]
	 *
	 * @throws IllegalStateException if [initialize] was never called. See also [isInitialized].
	 */
	fun removeAllFutureTrackTags()

TagsProcessingListener

It has inside 4 methods:

  1. onTagAdd(tag: Tag, activationTime: Long, status: Status) - callback of the addFutureTrackTag method Parameters: 1. tag - Tag instance for adding 2. activationTime - UNIX-timestamp in milliseconds of the tag activation time 3. status - Status of the operation. Status can be: Status.SUCCESS when tag was successfully uploaded to server Status.OFFLINE when tag wasn’t uploaded to server (no internet, etc.), but will be sent later (when internet connection will appears) Status.ERROR_TAG_OPERATION when operation can’t be proceeded on server because tag was already created earlier Status.ERROR_WRONG_TIME when user sent wrong tme (future) Status.ERROR_INVALID_TAG_SPECIFIED when tag name is null or empty

  2. onTagRemove(tag: Tag, deactivationTime: Long, status: Status) - callback of the removeFutureTrackTag method Parameters: 1. tag - Tag instance for removing 2. deactivationTime - UNIX-timestamp in milliseconds of the tag deactivation time 3. status - Status of the operation. Status can be: Status.SUCCESS when tag was successfully removed from server Status.OFFLINE when operation wasn’t pushed to server (no internet, etc.), but will be sent later (when internet connection will appears) Status.ERROR_TAG_OPERATION when operation can’t be proceeded on server because tag wasn’t exist Status.ERROR_WRONG_TIME when user sent wrong tme (future) Status.ERROR_INVALID_TAG_SPECIFIED when tag name is null or empty

  3. onAllTagsRemove(deactivatedTagsCount: Int, time: Long, status: Status)- callback of the removeAllFutureTrackTags method Parameters: 1. deactivatedTagsCount - deactivated tags amount 2. time - UNIX-timestamp in milliseconds (time of the operation) 3. status - Status of the operation. Status can be: Status.SUCCESS "Remove all tags" request was successfully proceeded Status.OFFLINE when operation wasn’t pushed to server (no internet, etc.), but will be sent later (when internet connection will appears) Status.ERROR_TAG_OPERATION when operation can’t be proceeded on server Status.ERROR_WRONG_TIME when user sent wrong tme (future)

  4. onGetTags(tags: Array<Tag>?, time: Long, status: Status)- callback of the getFutureTrackTags method Parameters: 1. tags - Array<Tag>? - array of tags. Can be null if status in not SUCCESS 2. time - UNIX-timestamp in milliseconds (time of the operation) 3.status - Status of the operation. Status can be: Status.SUCCESS - success Status.OFFLINE if there is no internet connection

Sample of using TagsProcessingListener

  1. Implement it on your side

val listener = object : TagsProcessingListener {
	override fun onTagAdd(status: Status, tag: Tag, activationTime: Long) {
		runOnUiThread {
			when (status) {
				Status.SUCCESS -> {
					// tag successfully added
				}
				Status.OFFLINE -> {
					// tag was saved to the local storage. It will be sent later when internet will be available
				}
				Status.ERROR_TAG_OPERATION -> {
					// unable to add tag to server (The tag has already been created)
				}
				Status.ERROR_WRONG_TIME -> {
					// Unable to perform operation. Future time specified.
				}
				Status.ERROR_INVALID_TAG_SPECIFIED -> {
					// null or blank tag name specified
				}
			}
		}
	}

	override fun onTagRemove(status: Status, tag: Tag, deactivationTime: Long) {
		runOnUiThread {
			when (status) {
				Status.SUCCESS -> {
					// tag was successfully removed
				}
				Status.OFFLINE -> {
					// tag deactivation was saved to the local storage. It will be sent later when internet will be available
				}
				Status.ERROR_TAG_OPERATION -> {
					// unable to add tag to server (Tag doesn't exist. Unable to remove)
				}
				Status.ERROR_WRONG_TIME -> {
					// Unable to perform operation. Future time specified.
				}
				Status.ERROR_INVALID_TAG_SPECIFIED -> {
					// null or blank tag name specified
				}
			}
		}
	}

	override fun onAllTagsRemove(status: Status, deactivatedTagsCount: Int, time: Long) {
		runOnUiThread {
			when (status) {
				Status.SUCCESS -> {
					// "Remove all tags" request was successfully proceeded
				}
				Status.OFFLINE -> {
					// "Remove all tags" request was saved to the local storage. It will be sent later when internet will be available
				}
				Status.ERROR_TAG_OPERATION -> {
					// unable to proceed on server
				}
				Status.ERROR_WRONG_TIME -> {
					// Unable to perform operation. Future time specified.
				}
			}
		}
	}

	override fun onGetTags(status: Status, tags: Array<Tag>?, time: Long) {
		runOnUiThread {
			when (status) {
				Status.SUCCESS -> {
					// all cached requests (for add/ remove/ remove all tags) were proceeded and tags fetched successfully
				}
				Status.OFFLINE {
					// can't fetch tags list. Try again later
				}
			}
		}
	}
}

2. Add it to the SDK:

TrackingApi.getInstance().addTagsProcessingCallback(listener)

3. Don’t forget to remove listener when it’s not needed:

TrackingApi.getInstance().removeTagsProcessingCallback()

Tags processing receiver

TagsProcessingReceiver works the same as TagsProcessingListener . But it's a BroadcastReceiver.

Methods are the same at all.

Sample of using TagsProcessingReceiver

  1. Add the following class to your application

class TagsReceiver : TagsProcessingReceiver() {
	override fun onTagAdd(status: Status, tag: Tag, activationTime: Long) {
		when (status) {
			Status.SUCCESS -> {
				// tag successfully added
			}
			Status.OFFLINE -> {
				// tag was saved to the local storage. It will be sent later when internet will be available
			}
			Status.ERROR_TAG_OPERATION -> {
				// unable to add tag to server (The tag has already been created)
			}
			Status.ERROR_WRONG_TIME -> {
        // Unable to perform operation. Future time specified.
      }
      Status.ERROR_INVALID_TAG_SPECIFIED -> {
					// null or blank tag name specified
			}
		}
	}

	override fun onTagRemove(status: Status, tag: Tag, deactivationTime: Long) {
		when (status) {
			Status.SUCCESS -> {
				// tag was successfully removed
			}
			Status.OFFLINE -> {
				// tag deactivation was saved to the local storage. It will be sent later when internet will be available
			}
			Status.ERROR_TAG_OPERATION -> {
				// unable to add tag to server (Tag doesn't exist. Unable to remove)
			}
			Status.ERROR_WRONG_TIME -> {
        // Unable to perform operation. Future time specified.
      }
      Status.ERROR_INVALID_TAG_SPECIFIED -> {
					// null or blank tag name specified
			}
		}
	}

	override fun onAllTagsRemove(status: Status, deactivatedTagsCount: Int, time: Long) {
		when (status) {
			Status.SUCCESS -> {
				// "Remove all tags" request was successfully proceeded
			}
			Status.OFFLINE -> {
				// "Remove all tags" request was saved to the local storage. It will be sent later when internet will be available
			}
			Status.ERROR_TAG_OPERATION -> {
				// unable to proceed on server
			}
			Status.ERROR_WRONG_TIME -> {
        // Unable to perform operation. Future time specified.
      }
		}
	}

	override fun onGetTags(status: Status, tags: Array<Tag>?, time: Long) {
		when(status) {
			Status.SUCCESS -> {
				// all cached requests (for add/ remove/ remove all tags) were proceeded and tags fetched successfully
			}
			Status.OFFLINE -> {
				// can't fetch tags list. Try again later
			}
		}
	}
}

2. Add this broadcast receiver to the manifest before the </application> tag.

<receiver android:name=".TagsReceiver"/>

3. Register it with SDK:

TrackingApi.getInstance().registerTagsReceiver(TagsReceiver::class.java)

4. Don't forget to unregister when it’s not needed:

TrackingApi.getInstance().unregisterTagsReceiver()
Previous*Subscribe to tracking eventsNext*Migration from SDK v1.6.x to SDK v2.0.x

Last updated 4 years ago

Was this helpful?