Signature
This module creates a canvas, and lets the users upload their signatures.
Preparation for starting the signature module
start method returns a Fragment that you can use to capture set number of
signatures. When number of signature will be taken is equal to your goal you can call the upload function inside the callback as below.
Add the imports below (Kotlin users can drop the trailing semicolons):
import ai.amani.sdk.Amani;
import android.util.Log;
Then capture the signatures and upload them as shown below:
int NUMBER_OF_SIGNATURE_WILL_BE_TAKEN = 1;
Amani.sharedInstance().Signature().start(this, NUMBER_OF_SIGNATURE_WILL_BE_TAKEN, (bitmap, countOfSignature) -> {
if (bitmap != null) {
if (NUMBER_OF_SIGNATURE_WILL_BE_TAKEN == countOfSignature) {
Amani.sharedInstance().Signature().upload(isSuccess -> {
if (isSuccess) {
Log.d(TAG, "Signature is uploaded");
} else {
Log.d(TAG, "Signature upload failed");
}
});
}
}
});
Adding Confirm and Clean button
You should add two buttons with label of clear and confirm.
Cleaning the Canvas
You can call clean function, on a button that sits on the top of the fragment.
Amani.sharedInstance().Signature().clean();
Confirm
To confirm the current signature user must press the confirm button and call this function.
Amani.sharedInstance().Signature().confirm(context);
Resetting the count of signatures
If you want to reset the process in the middle of capturing, you must call
resetCountOfSignature() method. It should be used when necessary as it's use
is optional.
Amani.sharedInstance().Signature().resetCountOfSignature();
Uploading the Signatures
Add the imports below:
import ai.amani.sdk.Amani
import android.util.Log
Then upload the captured signatures as shown below:
Amani.sharedInstance().Signature().upload { isSuccess: Boolean ->
Log.d(TAG, "upload isSuccess $isSuccess")
}