Configuration
This page describes the elements that every integration of the MobbSign Android SDK configures.
License
The license key is bound to the application ID of your app. The SDK validates it online the first time it is used and every time it expires and is renewed; between validations, signing does not need a connection.
mobbSignView.configureLicense(licenseKey, (licenseValidTo, licenseResult) -> {
if (licenseResult != MobbSignLicenseResult.VALID) {
// Inform the user: documents can be viewed, but not signed
}
});
licenseValidTo is the expiry date of the license. If the license is not valid, the document is still displayed, but any attempt to sign reports ERROR_LICENSE_INVALID.
Encryption key
setEncryptionKey(PublicKey) sets the public key that encrypts the biometric data of every signature. Without it, documents cannot be signed and onErrorOccurred reports ERROR_MANDATORY_PARAMS. See the quick start for an example that loads a PEM key.
Events
| Listener | Called when |
|---|---|
setOnDocumentShownListener | The document has been loaded and shown. It receives editable: true if the document contains form fields. |
setOnSignButtonPressedListener | The user taps Sign. |
setOnSignatureAcquiredListener | The user has drawn a signature, before it is confirmed. |
setOnSignatureDeletedListener | The user has deleted the signature drawn. |
setOnDocumentSignedListener | A signature has been added to the document. |
setOnBackButtonPressedListener | The user taps Back. |
setOnProcessEndListener | The user has finished. It receives the signed document. |
setOnErrorOccurredListener | An error has occurred. It receives the error code and a map with details. |
onDocumentSigned receives the details of the signature just added:
| Parameter | Type | Description |
|---|---|---|
document | byte[] | The signed document. |
encryptedSignatureData | byte[] | The encrypted signature data: biometric data, document hash and the rest of the signature information. |
signatureBitmap | Bitmap | The image of the signature. |
signaturePage | int | The page where the signature has been placed. |
signatureCoord | Rect | The coordinates of the signature on the page. |
Load a document
loadPDFDocument accepts a file path or an InputStream. To fill in the form fields of the document when it is loaded, pass a map with the field names and their values:
// From a file path
mobbSignView.loadPDFDocument(filePath, "Service contract");
// From a stream
mobbSignView.loadPDFDocument(inputStream, "Service contract");
// Filling in the form fields
Map<String, Object> fields = new HashMap<>();
fields.put("Name", "Jane Doe");
fields.put("NIF", "99999999A");
mobbSignView.loadPDFDocument(inputStream, "Service contract", fields);
Customisation bundle
The Bundle passed to the MobbSignView constructor configures the behaviour and appearance of the view. The keys are constants of MobbSignCustomizationProperties:
Bundle customizationBundle = new Bundle();
customizationBundle.putBoolean(MobbSignCustomizationProperties.SHOW_RELEVANT_MESSAGES, true);
customizationBundle.putInt(MobbSignCustomizationProperties.SIGNATURE_MIN_NUM_POINTS, 50);
mobbSignView = new MobbSignView(this, customizationBundle);
To change a property after the view has been created, for example for the next signer, use putCustomizationProperty(key, value). The properties are described in each guide:
| Area | Properties | Guide |
|---|---|---|
| Messages and signature validation | SHOW_RELEVANT_MESSAGES, SIGNATURE_MIN_NUM_POINTS | Customisation, Signature options |
| Legal notice | SHOW_BIOMETRIC_SIGNATURE_LEGAL_DIALOG, BIOMETRIC_SIGNATURE_LEGAL_DIALOG_TITLE, BIOMETRIC_SIGNATURE_LEGAL_DIALOG_MESSAGE | Legal notice |
| Text stamp | TEXTSTAMP_SIZE_MIN, TEXTSTAMP_SIZE_MAX, TEXTSTAMP_LINES_MAX, TEXTSTAMP_CHARACTERS_MAX | Signature options |
| Geolocation | DEVICE_POSITION_ENABLED, DEVICE_POSITION_LAST_TIME, DEVICE_POSITION_ACCURACY | Geolocation |
The Javadoc included in the distribution lists every property.