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.
Property
Data type
Description
Message
String
The message from the server or the error logged by the SDK.
Timestamp
String
The timestamp from Adjust’s servers.
Adid
String
A unique device identifier provided by Adjust.
JsonResponse
Map<String, Object>
The JSON object with the response from the server.
WillRetry
bool
Indicates whether there will be an attempt to resend a failed package.
Success callbacks
Set up success callbacks to trigger functions when the SDK records a session.
Example
This example shows how to register a sessionSuccessCallback that prints the timestamp at which the SDK sent the session data to Adjust.
Failure callbacks
Set up failure callbacks to trigger functions when the SDK fails to record a session.
Example
This example shows how to register a sessionFailureCallback that prints the reason the SDK failed to send the session data.
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.
Property
Data type
Description
Message
String
The message from the server or the error logged by the SDK.
Timestamp
String
The timestamp from Adjust’s servers.
Adid
String
A unique device identifier provided by Adjust.
JsonResponse
Map<String, Object>
The JSON object with the response from the server.
EventToken
String
The event token
CallbackId
String
The custom callback ID set on the event object
WillRetry
bool
Indicates whether there will be an attempt to resend a failed package.
Success callbacks
Set up success callbacks to trigger functions when the SDK records an event.
Example
This example shows how to register a eventSuccessCallback that prints the timestamp at which the SDK sent the event data to Adjust.
Failure callbacks
Set up failure callbacks to trigger functions when the SDK fails to record an event.
Example
This example shows how to register a eventFailureCallback that prints the reason the SDK failed to send the event data.