public final class Survey extends ServiceConnector implements ISurvey
ServiceConnector.InternalServiceConnectionACTION_BIND_V2, SERVICES_PACKAGE| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Abort the current survey.
|
static Survey |
getInstance(android.content.Context context)
Return a global instance of Survey, which is the default implementation of
ISurvey, and instantiate it if needed. |
protected java.lang.String |
getServiceName()
Must be overrided to provide service class name used for binding.
|
protected void |
onServiceReady(android.os.IBinder service)
Internal callback when service is connected.
|
protected void |
onServiceUnbinded()
Internal callback when service is disconnected.
|
void |
registerSurveyDoneListener(ISurveyDoneListener listener)
Register a new listener to receive survey results.
|
SurveyRequest |
start(SurveyInputData inputData)
Prompt user to answer the survey.
|
void |
unregisterSurveyDoneListener(ISurveyDoneListener listener)
Unregister an existing survey listener.
|
connect, connectSync, disconnect, ensureServiceIsReady, getBindIntent, getContext, isConnectedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconnect, disconnect, isConnectedpublic static Survey getInstance(android.content.Context context)
ISurvey, and instantiate it if needed.
Be aware that only one instance will be created for the whole application, so the associated
context should not be a component which could be destroyed at some point, ie. an Activity.
Passing the Application to this method is preferred over other context types.
context - A valid context to initialize the instance.public SurveyRequest start(SurveyInputData inputData) throws IngenicoException
Example:
ISurveysurvey = Survey.getInstance(context); // First register to surveyDone to show up survey result survey.registerSurveyDoneListener(surveyListener); // Prepare Survey input dataSurveyInputDatainputData =SurveyInputData.builder() .setMessage("") .setSurveySettings(SurveySettings.builder() .setSurveyFormat(SurveyFormat.SURVEY_FORMAT_STAR) .setRatingMaxValue(5) .build()) .build(); // Start the SurveySurveyRequestrequest = survey.start(inputData); // Check if request has been accepted if (request.isSurveyAccepted()) { // Ok, the Survey is being processed }
start in interface ISurveyIngenicoException - when a failure occurs while starting a surveypublic void abort()
throws IngenicoException
Example:
survey.abort();
abort in interface ISurveyIngenicoException - when a failure occurs while aborting a surveyprotected java.lang.String getServiceName()
ServiceConnectorgetServiceName in class ServiceConnectorpublic void registerSurveyDoneListener(ISurveyDoneListener listener)
ISurveyregisterSurveyDoneListener in interface ISurveypublic void unregisterSurveyDoneListener(ISurveyDoneListener listener)
ISurveyunregisterSurveyDoneListener in interface ISurveyprotected void onServiceReady(android.os.IBinder service)
ServiceConnectoronServiceReady in class ServiceConnectorprotected void onServiceUnbinded()
ServiceConnectoronServiceUnbinded in class ServiceConnector