Getting started with MobbSign
Initialization
First step is always initializing the API. You need to this before any other action or SDK will not work. You need your license key to complete this step.
So, set up the license id and listen to the possible result:
mobbSignView.configureLicense("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
new LicenseStatusListener() {
@Override
public void checkLicenseResult(Date licenseValidTo, MobbSignLicenseResult licenseResult) {
// License status could be: VALID, NOT_VALID, EXPIRED, ...
}
});
Configuring the SDK
Configure the public key that is going to be used to encrypt the biometric data embedded to the document:
mobbSignView.setEncryptionKey(publicKey);
Define your own listeners and implement the events you need to know about:
mobbSignView.setOnDocumentShownListener(new MobbSignDocumentShownListener() {
@Override
public void onDocumentShown(boolean editable) {
// The document has been fully loaded and shown to the user.
}
});
mobbSignView.setOnDocumentSignedListener(new MobbSignDocumentSignedListener() {
@Override
public void onDocumentSigned(byte[] document, byte[] encryptedSignatureData, Bitmap signatureBitmap, int signaturePage, Rect signatureCoord) {
// The document has been successfully signed.
}
});
mobbSignView.setOnSignatureAcquisedListener(new MobbSignSignatureAcquisedListener() {
@Override
public void onSignatureAcquised() {
// The handwritten signature has been acquired for the user.
}
});
mobbSignView.setOnSignatureDeletedListener(new MobbSignSignatureDeletedListener() {
@Override
public void onSignatureDeleted() {
// The handwritten signature has been deleted for the user.
}
});
mobbSignView.setOnBackButtonPressedListener(new MobbSignBackButtonPressedShownListener() {
@Override
public void onBackButtonPressed() {
// The back button has been pressed.
}
});
mobbSignView.setOnSignButtonPressedListener(new MobbSignSignButtonPressedListener() {
@Override
public void onSignButtonPressed() {
// The document has been fully loaded and shown to the user.
}
});
mobbSignView.setOnErrorOccurredListener(new MobbSignErrorOccurredListener() {
@Override
public void onErrorOccurred(int errorCode, HashMap<String, Object> errorDetails) {
// An error occurs during the process.
}
});
mobbSignView.setOnProcessEndListener(new MobbSignProcessEndListener() {
@Override
public void onProcessEnd(byte[] document) {
// The acquisition process has finished.
}
});
- Listener to attend fingerprint acquisition process: (see Fingerprint options below)
mobbSignView.setOnFingerprintAcquisitionListener(new FingerprintAcquisitionListener()
{
@Override
public void onSensorReadyToSwipe() {
// Alert the user to swipe his/her finger on the sensor.
}
@Override
public void onImageCaptured() {
// Alert the user that an image has been captured.
}
@Override
public void onError(FingerprintError error) {
/* Alert when error has been occurred. The possibles causes are:
FINGERPRINT_INITIALIZATION_FAILED: Unable to initialize the Biometrics API.Perhaps the Tactivo Manager is not installed.
FINGERPRINT_AREA_TOO_SMALL: Alert the user that the area of the fingerprint within the image was too small.
FINGERPRINT_QUALITY_TOO_BAD: Alert the user that the quality of the image was too bad.
FINGERPRINT_SWIPE_TOO_FAST: Alert the user that the swipe was too fast.
FINGERPRINT_READER_NOT_AVAILABLE: Fingerprint reader is not connected or not started.
FINGERPRINT_UNEXPECTED_ERROR: When an expected exception has been occurred.
*/
}
});
Start process
Once the API is initialized and the SDK is configured as you need it, you have to start a new sign process.
Let's go to load the document:
mobbSignView.loadPDFDocument(getResources().getAssets().open("sample.pdf"), "Document title");
Different ways to load documents
From document source:
public void loadPDFDocument(String filePath, String documentTitle)
From document source with data on editable document fields:
public void loadPDFDocument(String filePath, String documentTitle, Map<String, Object> inputFields)
Passing data file content:
public void loadPDFDocument(InputStream inputStream, String documentTitle)
Passing data file content with preloading data on editable document fields:
public void loadPDFDocument(InputStream inputStream, String documentTitle, Map<String, Object> inputFields)