Kofax Mobile SDK API Reference
|
Public Member Functions | |
CaptureServer (String serverURL, SourceServer sourceServer) | |
void | setCertificateValidatorListener (CertificateValidatorListener certificateValidatorListener) |
void | setServerTimeout (int timeout) |
Change the connection timeout. More... | |
int | getServerTimeout () |
Get the connection timeout (in seconds). More... | |
void | registerDevice (final ICompletionListener< Void > completionListener) |
Register a mobile device with the server and obtain a license, if available. More... | |
void | login (UserProfile userProfile, final ICompletionListener< List< String >> completionListener) |
Login to the server using credentials from the UserProfile object. More... | |
void | loginAnonymously (final ICompletionListener< List< String >> completionListener) |
Fetches the device profile shortcuts from the server. More... | |
void | logout (final ICompletionListener< Void > completionListener) |
Logout from the Server if logged in. More... | |
void | getDocumentType (String documentTypeName, final ICompletionListener< DocumentType > completionListener) |
Returns the DocumentType object which corresponds to the documentTypeName Specified. More... | |
void | startJobService (final ICompletionListener< String > completionListener) |
This will start a new document submission job on the server. More... | |
void | sendImageService (Document document, String jobID, Image image, int ImageIndex, boolean lastImage, final ICompletionListener< Void > completionListener) |
Sends an Image to the server. More... | |
void | submitDocument (Document document, IProgressListener iProgressListener, final ICompletionListener iCompletionListener) |
ErrorInfo | cancelSubmission (String submitJobID) |
A reference implementation of ICaptureServer that allows you to login, download a list of Document Types from the server and submit application-created documents to the server. Server communication requires a valid license to be set.
CaptureServer | ( | String | serverURL, |
SourceServer | sourceServer | ||
) |
Create a new CaptureServer using the given server URL and SourceServer.
serverURL | The URL of the server. |
sourceServer | Type of the Server |
KmcRuntimeException | (KMC_UT_LICENSE_LOGISTICS) |
IllegalArgumentException | ("server url is null") |
IllegalArgumentException | ("SourceServer is null") |
ErrorInfo cancelSubmission | ( | String | submitJobID | ) |
The only operation that is currently cancellable is the submitDocument method.
submitJobID | JobID of the submission operation from progress listener results. |
Implements ICaptureServer.
void getDocumentType | ( | String | documentTypeName, |
final ICompletionListener< DocumentType > | completionListener | ||
) |
Returns the DocumentType object which corresponds to the documentTypeName Specified.
The DocumentType object is created based on the corresponding DocumentType downloaded from Server. The documentTypeName indicates which DocumentType to download from Server. Returns the DocumentType object, and is fired once the DocumentType object has been successfully downloaded from Server.
documentTypeName | This indicates which DocumentType to download. |
completionListener | A completion listener, return results as well as any Exceptions. |
IllegalArgumentException | ("CompletionListener cannot be null") |
Implements ICaptureServer.
int getServerTimeout | ( | ) |
Get the connection timeout (in seconds).
Timeout defaults to 20 seconds.
void login | ( | UserProfile | userProfile, |
final ICompletionListener< List< String >> | completionListener | ||
) |
Login to the server using credentials from the UserProfile object.
The login() method returns List of document type names. You must first call registerDevice() to obtain a license, before calling login(). You may need to register your device after login, if registration requires authentication. The UserProfile object passed in as a parameter must contain valid user credentials, in order for the login() method to succeed.
userProfile | This contains the login credentials of the user. |
completionListener | A completion listener, return results as well as any Exceptions. |
IllegalArgumentException | ("CompletionListener cannot be null") |
Implements ICaptureServer.
void loginAnonymously | ( | final ICompletionListener< List< String >> | completionListener | ) |
Fetches the device profile shortcuts from the server.
loginAnonymously() returns list of document names. You can only fetch the shortcuts if you have previously registered your device. You may need to register your device after login, if registration requires authentication.
completionListener | A completion listener, return results as well as any Exceptions. |
IllegalArgumentException | ("CompletionListener cannot be null") |
Implements ICaptureServer.
void logout | ( | final ICompletionListener< Void > | completionListener | ) |
Logout from the Server if logged in.
The logout() method can only be called after calling the login() method.
completionListener | A completion listener, return results as well as any Exceptions. |
IllegalArgumentException | ("CompletionListener cannot be null") |
Implements ICaptureServer.
void registerDevice | ( | final ICompletionListener< Void > | completionListener | ) |
Register a mobile device with the server and obtain a license, if available.
The registerDevice() method must be called prior to calling login() or any other methods in the CaptureServer object which initiate communication with the server. If device registration fails then the listener is called with KmcRuntimeException. If the Require Authentication for Registration setting is enabled on the KFS or KTA server, then the following response code is returned after registerDevice(); ErrorInfo#KMC_LO_REGISTER_REQUIRES_AUTH. Therefore the recommended procedure is to call registerDevice() and if successful then login(). If registerDevice() returns ErrorInfo#KMC_LO_REGISTER_REQUIRES_AUTH then login() and run registerDevice() again.
sample code to call register device :
ICaptureServer captureServer = new CaptureServer("http:sampleServer.com/path", serverType);
captureServer.registerDevice(new ICompletionListener<Void>(){
@literal @Override
public void onComplete(Void ignore, Exception e) {
if(e != null) {
ErrorInfo info = ((KmcRuntimeException)e).getErrorInfo();
if (info == ErrorInfo.KMC_LO_REGISTER_REQUIRES_AUTH) {
// call login() and run registerDevice() again.
}
} else {
// device registered successfully.
}
}
});
completionListener | A completion listener, return results as well as any Exceptions. |
IllegalArgumentException | ("CompletionListener cannot be null") |
Implements ICaptureServer.
void sendImageService | ( | Document | document, |
String | jobID, | ||
Image | image, | ||
int | ImageIndex, | ||
boolean | lastImage, | ||
final ICompletionListener< Void > | completionListener | ||
) |
Sends an Image to the server.
SendImageService method will be used to send the single image to the server using the given JobID.
document | This contains the document data. |
jobID | The unique ID of the document submission job. |
image | The image field. |
ImageIndex | The image index in the document submission job, should start with 0. |
lastImage | This indicates the last image in the job submission. |
completionListener | A completion listener, return results as well as any Exceptions. |
IllegalArgumentException | ("CompletionListener cannot be null") |
Implements ICaptureServer.
void setCertificateValidatorListener | ( | CertificateValidatorListener | certificateValidatorListener | ) |
Setter for certificate validator listener. The listener receives certificate validation challenge in response to an authentication request from the remote server.
certificateValidatorListener |
void setServerTimeout | ( | int | timeout | ) |
Change the connection timeout.
This parameter corresponds to all connection timeouts, specified in seconds: connect, read, and write. If any operation exceeds the timeout, the process is cancelled, and an exception will be raised.
Timeout defaults to 20 seconds. Note that providing an invalid value (such as 0 or any negative number) will reset the timeout to the default value.
void startJobService | ( | final ICompletionListener< String > | completionListener | ) |
This will start a new document submission job on the server.
This will start a new document submission job by calling the startJob method on the server. This will return a unique job ID, which can be used to concurrently submit documents. Submit the images in the document by calling the sendImageService() after getting the job ID.
completionListener | A completion listener, return results as well as any Exceptions. |
IllegalArgumentException | ("CompletionListener cannot be null") |
Implements ICaptureServer.
void submitDocument | ( | Document | document, |
IProgressListener | iProgressListener, | ||
final ICompletionListener | iCompletionListener | ||
) |
The submitDocument method submits a Document to KFS/KTA, including all fields and pages. Within each page, only the image indicated by the property currentImageIndex is included in the Document submission.
document | this contains the docuement data. |
iProgressListener | A progress listener, return progress results and submitJobID. |
iCompletionListener | A completion listener, return results as well as any Exceptions. |
Implements ICaptureServer.