SDK Events
You can set the invitation listener to an instance of DefaultInviteListener
to get notified when the following events occur:
- Invite presented
- Invite accepted
- Invite declined
- Invite cancelled due to network error
- Invite not shown due to network error
- Invite not shown since user does not meet eligibility criteria
- Invite not shown since user is not in sampling pool
- Survey presented
- Survey completed
- Survey cancelled by user
- Survey cancelled due to network error
To receive these events, override the DefaultInviteListener and assign it to the ForeSee® SDK using ForeSee.setInviteListener()
, implementing the methods below.
For more information, please refer to our API documentation.
onInvitePresented
onInviteCompleteWithAccept
onInviteCompleteWithDecline
onInviteCancelledWithNetworkError
onInviteNotShownWithNetworkError
onInviteNotShownWithEligibilityFailed
onInviteNotShownWithSamplingFailed
onSurveyPresented
onSurveyCompleted
onSurveyCancelledByUser
onSurveyCancelledWithNetworkError
Avoiding conflicts with other invitations/offers
The SDK events listed can be useful to prevent conflicts with other invitations/offers. For example, if you only want a user to see a maximum of one solicitation, you can listen for
onInvitePresented
. If you receive a post notification, you can then suppress other invitations/offers (mailing list invitation, app store ratings, etc.).
A Simple Example
ForeSee.setInviteListener(new DefaultInviteListener() {
@Override
public void onInvitePresented(MeasureConfiguration measureConfiguration) {
Toast.makeText(getApplicationContext(),
"Invitation presented",
Toast.LENGTH_SHORT).show();
}
@Override
public void onSurveyPresented() {
Toast.makeText(getApplicationContext(),
"Survey completed",
Toast.LENGTH_SHORT).show();
}
@Override
public void onSurveyCompleted() {
Toast.makeText(getApplicationContext(),
"Survey completed",
Toast.LENGTH_SHORT).show();
}
@Override
public void onSurveyCancelledByUser() {
Toast.makeText(getApplicationContext(),
"Survey cancelled by user",
Toast.LENGTH_SHORT).show();
}
@Override
public void onSurveyCancelledWithNetworkError() {
Toast.makeText(getApplicationContext(),
"Survey cancelled due to network error",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteCancelledWithNetworkError() {
Toast.makeText(getApplicationContext(),
"Invitation cancelled due to network error",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteCompleteWithAccept() {
Toast.makeText(getApplicationContext(),
"Invitation accepted by user",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteCompleteWithDecline() {
Toast.makeText(getApplicationContext(),
"Invitation declined by user",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteNotShownWithNetworkError(MeasureConfiguration measureConfiguration) {
Toast.makeText(getApplicationContext(),
"No invite shown due to network error",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteNotShownWithEligibilityFailed(MeasureConfiguration measureConfiguration) {
Toast.makeText(getApplicationContext(),
"No invite shown: user not eligible for invite",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteNotShownWithSamplingFailed(MeasureConfiguration measureConfiguration) {
Toast.makeText(getApplicationContext(),
"No invite shown: user not in sampling pool",
Toast.LENGTH_SHORT).show();
}
});
Updated almost 4 years ago