ClicktermDialog controls the clickwrap consent dialog shown to end users in your Android app.
Methods
show
Displays a clickwrap dialog. If the user has already accepted the latest effective major version, the onSuccess callback fires with a null Signature.
ClicktermDialog.show(
Activity activity,
ClickwrapTemplate request,
JSONObject configOptions, // nullable
ClicktermDialog.OnAgreementResultListener listener
);
Parameters:
| Parameter | Type | Description |
|---|
activity | Activity | The current Android Activity |
request | ClickwrapTemplate | Request object with template ID, user ID, placeholders, and language |
configOptions | JSONObject | Optional configuration (pass null for defaults) |
listener | OnAgreementResultListener | Callback for success/error |
ClickwrapTemplate constructor:
new ClickwrapTemplate(
String clickwrapTemplateId,
String endUserId,
Map<String, Object> templatePlaceholders,
String languageCode
);
| Parameter | Type | Required | Description |
|---|
clickwrapTemplateId | String | Yes | Template ID from the dashboard |
endUserId | String | Yes | Your identifier for the end user (max 256 chars) |
templatePlaceholders | Map<String, Object> | No | Key-value pairs for placeholder substitution |
languageCode | String | No | Language code (e.g., "en") |
Example:
Map<String, Object> placeholders = new HashMap<>();
placeholders.put("fullName", "Alice Example");
placeholders.put("email", "[email protected]");
placeholders.put("company", "Acme Corp");
ClickwrapTemplate request = new ClickwrapTemplate(
"YOUR_TEMPLATE_ID", endUserId, placeholders, "en"
);
ClicktermDialog.show(this, request, null,
new ClicktermDialog.OnAgreementResultListener() {
@Override
public void onSuccess(String clicktermSignature) {
if (clicktermSignature == null) {
Log.i("Clickterm", "User already accepted.");
} else {
// Send Signature to your backend for verification
Log.i("Clickterm", clicktermSignature);
}
}
@Override
public void onError(String message) {
Log.e("Clickterm", message);
}
}
);
showAcceptedContent
Displays the previously accepted clickwrap content.
ClicktermDialog.showAcceptedContent(
Activity activity,
ClickwrapAcceptedAgreementRequest request,
ClicktermDialog.OnAcceptedContentListener listener
);
Example:
ClickwrapAcceptedAgreementRequest request =
new ClickwrapAcceptedAgreementRequest(templateId, endUserId, "en");
ClicktermDialog.showAcceptedContent(this, request,
new ClicktermDialog.OnAcceptedContentListener() {
@Override
public void onSuccess(ClickwrapTemplateContent content) {
Log.i("Clickterm", content.getContent());
}
@Override
public void onError(String message) {
Log.e("Clickterm", message);
}
}
);
Only works if the user has an accepted and verified event for this template.