UserContextApi

Use this API to access and listen to the user's context.

UserContextApi API

addUserContextUpdateListener()

void addUserContextUpdateListener(UserContextUpdateListener listener)

Adds a listener that will be invoked when the user's current context is updated. The user context updates delivered by this listener will not be filtered according to any (user context) criteria and will not include any provisional events (see isProvisional).

If the listener instance provided has been previously added, then it will be replaced. The user context criteria of interest (for the said listener) will also be replaced.

Calling this function has the same effect as calling addUserContextUpdateListener(false, listener).

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

Parameters

listener

A UserContextUpdateListener that gets triggered when the user context has changed.

addProvisionalAwareUserContextUpdateListener()

void addProvisionalAwareUserContextUpdateListener(UserContextUpdateListener listener)

Adds a listener that will be invoked when the user's current context is updated. The user context updates delivered by this listener will not be filtered according to any (user context) criteria, and may include provisional events (see isProvisional).

If the listener instance provided has been previously added, then it will be replaced. The user context criteria of interest (for the said listener) will also be replaced.

Calling this function has the same effect as calling addUserContextUpdateListener(false, listener).

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

Parameters

listener

A UserContextUpdateListener that gets triggered when the user context has changed.

addUserContextUpdateListener()

void addUserContextUpdateListener(List<UserContextUpdateCriteria> criteria, UserContextUpdateListener listener)

Adds a listener that will be invoked when the user's current context is updated. You can filter the context criteria you are interested in.

The user context updates delivered by this listener will not include any provisional events (see isProvisional).

If the listener instance provided has been previously added, then it will be replaced. The user context criteria of interest will also be replaced.

Calling this function has the same effect as calling addUserContextUpdateListener(false, criteria, listener).

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

Parameters

criteria

A list that filters which UserContextUpdateCriteria to return.

listener

A UserContextUpdateListener that gets triggered when the user context has changed.

addProvisionalAwareUserContextUpdateListener()

void addProvisionalAwareUserContextUpdateListener(List<UserContextUpdateCriteria> criteria, UserContextUpdateListener listener)

Adds a listener that will be invoked when the user's current context is updated. You can filter the context criteria you are interested in.

The user context updates delivered by this listener may include provisional events (see isProvisional).

If the listener instance provided has been previously added, then it will be replaced. The user context criteria of interest will also be replaced.

Calling this function has the same effect as calling addUserContextUpdateListener(false, criteria, listener).

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

Parameters

criteria

A list that filters which UserContextUpdateCriteria to return.

listener

A UserContextUpdateListener that gets triggered when the user context has changed.

requestUserContext()

PendingOperation<UserContext, RequestUserContextError> requestUserContext()

Retrieves the user's current context. Provisional events are not included in the result (see isProvisional).

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

requestUserContextIncludingProvisionalEvents()

PendingOperation<UserContext, RequestUserContextError> requestUserContextIncludingProvisionalEvents()

Retrieves the user's current context. Provisional events may be included in the result (see isProvisional).

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

removeUserContextUpdateListener()

void removeUserContextUpdateListener(UserContextUpdateListener listener)

Removes a previously set user context update listener.

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

Parameters

listener

A UserContextUpdateListener that gets triggered when the user context has changed.

Last updated