*Subscribe to tracking events
Tracking events broadcast receiver
You can implement an instance of TrackingEventsReceiver and subscribe to tracking events.
Add following class to your application:
class TrackingReceiver : TrackingEventsReceiver() {
override fun onLocationChanged(context: Context, location: Location) {
// Location updates
}
override fun onStartTracking(context: Context) {
// tracking was started
}
override fun onStopTracking(context: Context) {
// tracking was stopped
}
override fun onSpeedViolation(context: Context, violation: SpeedViolation) {
// Receive speed violation
}
override fun onNewEvents(context: Context, events: Array<Event>) {
// receive an updates about new events
}
override fun onSdkDeprecated(context: Context) {
// receive callback about deprecated events
}
}Add this broadcast receiver to the manifest before the </application> tag.
Register it:
Don't forget to unregister when it’s not needed:
Listeners
Start and stop tracking callback
Callback to be invoked when new location was found
Speed violation callback
Last updated
Was this helpful?