EventTimelineApi

Use this API to query for historic timeline events, and subscribe for real time timeline updates.

EventTimeline API

getTimelineEvent()

@Nullable Event getTimelineEvent(String eventId)

Returns the timeline event with the specified ID, or null if no such event exists.

Note: calling this method on an uninitialized SDK will throw an SdkException.

Parameters

eventId

The event ID.

getTimelineEvents()

List<Event> getTimelineEvents(Date fromDate, Date toDate)

Returns timeline events, such as transport and stationary events, that were captured during the specified date range. The events are ordered from oldest to newest.

Events that were captured outside of the specified date range are not returned, even if they were updated during this date range. To get all updates, regardless of when an event was captured, use getTimelineUpdates(Date) instead.

Note: calling this method on an uninitialized SDK will throw an SdkException.

Parameters

fromDate

The start date of the date range. The specified date is inclusive.

toDate

The end date of the date range. The specified date is inclusive.

getTimelineUpdates()

List<Event> getTimelineUpdates(Date afterDate)

Returns all updated events in the event timeline after the specified date, sorted by the last update time.

This method returns all events that started after afterDate, but it may also return events that started before afterDate, if they were updated afterwards. The returned result is not necessarily the complete list of events that were captured by the SDK from the result's first event until the last, because events that were not updated will be excluded. To get a complete and ordered list of events for a given date range, use getTimelineEvents(Date, Date) instead.

You can use this method along with setTimelineUpdateListener(EventTimelineUpdateListener) to stay up to date with the latest events in the timeline. For example, to make sure you don't miss out on timeline updates, you can first set an update listener, then follow up by using this method to query for potential updates since the last update you received. Sample code demonstrating this case be found here.

Note: calling this method on an uninitialized SDK will throw an SdkException.

Parameters

afterDate

The date to retrieve updates from. The specified date is exclusive.

setTimelineUpdateListener()

List<Event> getTimelineUpdates(Date afterDate)

Sets a listener that is invoked when the event timeline is updated. The listener receives the updated events. An update can be triggered by the start of a new event, and the update or end of an existing one. Every invocation of the listener will deliver an event that has a lastUpdateTime that is equal to or greater than the previously delivered event's lastUpdateTime.

You can use this method along with getTimelineUpdates(Date) to stay up to date with the latest events in the timeline. For example, to make sure you don't miss out on timeline updates, you can first set an update listener using this method, then follow up by calling getTimelineUpdates(Date) to query for potential updates since the last update you received. Sample code demonstrating this case be found here.

Note: calling this method on an uninitialized SDK will throw an SdkException.

Last updated