HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center

Survey Callbacks for Android

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

🚧

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.setOnFinishCallback(new OnFinishCallback() {
            @Override
            public void onFinish(String surveyId, String state, JSONObject response) {
            }
        });
Surveys.setOnFinishCallback(OnFinishCallback {
            }
        )

What’s Next

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