adjust-icon

Send callback information

Set up callbacks to trigger functions when the SDK sends information to Adjust. You can set up callbacks for sessions and events.

Session callbacks

Set up session callbacks to trigger functions when the SDK sends session information. You can create success callbacks and failure callbacks. Success callbacks trigger when the SDK sends information to Adjust’s servers. Failure callbacks trigger when the SDK encounters a problem while sending the information.

Session callbacks have access to a response data object. You can use its properties in your callback function.

PropertyData typeDescription
MessageStringThe message from the server or the error logged by the SDK.
TimestampStringThe timestamp from Adjust’s servers.
AdidStringA unique device identifier provided by Adjust.
JsonResponseDictionary <String, Object>The JSON object with the response from the server.
WillRetryBooleanIndicates whether there will be an attempt to resend a failed package.

Success callbacks

Method signature
public void setOnSessionTrackingSucceededListener(OnSessionTrackingSucceededListener onSessionTrackingSucceededListener)

Set up success callbacks to trigger functions when the SDK records a session.

Example

This example shows how to create a callback function sessionSuccess and register it as a success callback. The function logs the timestamp at which the SDK recorded the session.

Failure callbacks

Method signature
public void setOnSessionTrackingFailedListener(OnSessionTrackingFailedListener onSessionTrackingFailedListener)

Set up failure callbacks to trigger functions when the SDK fails to record a session.

Example

This example shows how to create a callback function sessionFailure and register it as a failure callback. The function logs the session failure message.

Event callbacks

Set up event callbacks to trigger functions when the SDK sends event information. You can create success callbacks and failure callbacks. Success callbacks trigger when the SDK sends information to Adjust’s servers. Failure callbacks trigger when the SDK encounters a problem while sending the information.

Event callbacks have access to a response data object. You can use its properties in your callback function.

PropertyData typeDescription
MessageStringThe message from the server or the error logged by the SDK.
TimestampStringThe timestamp from Adjust’s servers.
AdidStringA unique device identifier provided by Adjust.
EventTokenStringThe event token
CallbackIdStringThe custom callback ID set on the event object
JsonResponseDictionary <String, Object>The JSON object with the response from the server.
WillRetryBooleanIndicates whether there will be an attempt to resend a failed package.

Success callbacks

Method signature
public void setOnEventTrackingSucceededListener(OnEventTrackingSucceededListener onEventTrackingSucceededListener)

Set up success callbacks to trigger functions when the SDK records an event.

Example

This example shows how to create a callback function eventSuccess and register it as a success callback. The function logs the timestamp at which the SDK recorded the event.

Failure callbacks

Method signature
public void setOnEventTrackingFailedListener(OnEventTrackingFailedListener onEventTrackingFailedListener)

Set up failure callbacks to trigger functions when the SDK fails to record an event.

Example

This example shows how to create a callback function eventFailure and register it as a failure callback. The function logs the event failure message.