Callbacks
Covered here is how to set up the callback that fires with every new message received.
Avoiding Memory Leaks
These APIs hold the callbacks in a strong reference, so we strongly suggest to avoid registering callbacks without unregistering them when needed, as it may cause a memory leak.
New Received Message
This block is executed each time a new message is received. This can be used to show your own UI when a new message is received.
Replies.setOnNewReplyReceivedCallback(new Runnable() {
@Override
public void run() {
//Show an alert to notify users about a new message.
}
});
Replies.setOnNewReplyReceivedCallback {
//Show an alert to notify users about a new message.
}
Updated over 4 years ago
What’s Next
You can set custom data, such as a user attribute, at any time, including inside callbacks. Logging user events in callbacks is possible as well.