Callbacks

Covered here is how to set up the callback that fires before and after every survey is shown.

🚧

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.

You can execute code in a callback that gets called before a survey is shown and after it has been dismissed. You can use this for things like pausing and resuming a game, for example.

Before Showing the Survey

Surveys.setOnShowCallback(new Runnable() { @Override public void run() { //Pause game } });
Surveys.setOnShowCallback(OnShowCallback { //Pause game } )

After the Survey Has Been Dismissed

Surveys.setOnDismissCallback(new OnDismissCallback() { @Override public void onDismiss() { } });
Surveys.setOnDismissCallback { }

What’s Next

Do more with callbacks, like adding user attributes and events as well as additional logs.