Event Handlers
Covered here is how to set up the event handler that fire before and after every survey is shown.
You execute code in a handler that gets called before a survey is shown, and after it has been dismissed. Use those for things like pausing and resuming a game, for example.
Before Showing the Survey
//iOS
IBGSurveys.WillShowSurveyHandler = () =>
{
System.Console.WriteLine("New Survey");
};
//Android
Surveys.SetOnShowCallback(new IPreShowingSurveyRunnable());
public class IPreShowingSurveyRunnable : Java.Lang.Object, IOnShowCallback
{
public void OnShow()
{
Android.Util.Log.Warn("PreShowingSurvey", "Pre Showing survey");
}
}
After the Survey Has Been Dismissed
//iOS
IBGSurveys.DidDismissSurveyHandler = () =>
{
System.Console.WriteLine("Did Dismiss Survey");
};
//Android
Surveys.SetOnDismissCallback(new IOnDismissSurveyCallback());
public class IOnDismissSurveyCallback : Java.Lang.Object, IOnDismissCallback
{
public void OnDismiss()
{
Android.Util.Log.Warn("PreShowingSurvey", "Pre Showing survey");
}
}
Updated about 5 years ago
What’s Next
Use the event handlers even better by adding user attributes and events in them as well as adding additional logs.