Kofax Mobile SDK API Reference
|
Classes | |
class | Error |
class | HttpClientHolder |
Public Member Functions | |
ServerProjectProvider (Context ctx, String baseUrl) throws MalformedURLException | |
ServerProjectProvider (Context ctx, IBundleCacheProvider cacheProvider, String baseUrl, ConnectivityManager connectivityManager) throws MalformedURLException | |
void | setCertificateValidatorListener (CertificateValidatorListener certificateValidatorListener) |
void | setRequestTimeout (long duration, TimeUnit timeUnit) |
void | getHighestVersion (final String projectName, final String sdkVersion, final ICompletionListener< String > listener) |
String | getLatestCachedModelDataBuildInfo (String projectName) |
void | getProject (final String projectName, final String version, final ICompletionListener< File > listener) |
void | getVariant (final String projectName, final String variantName, final String version, final ICompletionListener< File > listener) |
void | loadAllVariantsForProject (final String projectName, final ICompletionListener< Void > listener) |
void | cancelLoadAllVariants () |
Protected Member Functions | |
Task< String > | getHighestVersionAsync (final String projectName, final String sdkVersion, final boolean bulk) |
String | sdkVersion () |
A reference implementation of IProjectProvider that downloads assets from a Kofax Quick Updater service instance
Note: it is required for the app or user to have android.permission.ACCESS_NETWORK_STATE
permission before calling any method in this class
ServerProjectProvider | ( | Context | ctx, |
String | baseUrl | ||
) | throws MalformedURLException |
Create a new ServerProjectProvider using the Kofax Quick Updater server instance at the given base URL.
ctx | This context |
baseUrl | The Kofax Quick Updater instance URL |
Unfortunately, because of this constructor, we cannot check the validity of the cache provider and connectivity parameters.
ServerProjectProvider | ( | Context | ctx, |
IBundleCacheProvider | cacheProvider, | ||
String | baseUrl, | ||
ConnectivityManager | connectivityManager | ||
) | throws MalformedURLException |
Create a new ServerProjectProvider using a custom cache provider, using the Kofax Quick Updater server instance at the given base URL.
ctx | This context |
cacheProvider | The cache provider |
baseUrl | The Kofax Quick Updater instance URL |
connectivityManager | A connectivity manager for checking network status |
void cancelLoadAllVariants | ( | ) |
Cancels any outstanding tasks related to loadAllVariantsForProject(String, ICompletionListener)
This function will do nothing if no tasks are outstanding.
If there are outstanding tasks, the ICompletionListener passed to loadAllVariantsForProject(String, ICompletionListener) will be called with a cancel success message
void getHighestVersion | ( | final String | projectName, |
final String | sdkVersion, | ||
final ICompletionListener< String > | listener | ||
) |
This implementation keeps a map of project names to a map of sdk versions to model versions. If the map contains an entry for the key pair {projectName, sdkVersion}
, that value is returned, and no work is done.
If no entry exists, the network connection is checked. If a network connection exists, a server call is attempted. If that value is returned, it is stored in the map and returned.
If a server response is not acquired, local cached is checked. If a local version exists, that version is stored in the map and returned.
If no map entry exists, no network connection exists or a server call fails, and finally no cache exists, a ProjectProviderException is thrown with a message indicating work cannot continue.
projectName | The name of the project |
sdkVersion | The version of the SDK that must be compatible |
listener | A completion listener. If this is null, no work will be done. |
Implements IProjectProvider.
|
protected |
String getLatestCachedModelDataBuildInfo | ( | String | projectName | ) |
Get the project latest model data build information from cached project
projectName | The name of the project to retrieve |
Implements IProjectProvider.
void getProject | ( | final String | projectName, |
final String | version, | ||
final ICompletionListener< File > | listener | ||
) |
Returns the directory containing the project files. If the project files already exist in the provided IBundleCacheProvider, those will be used.
If no cache version exists, the network connection is checked. If a network connection exists, a server call is attempted. If the files are acquired from the server, they are cached and returned.
If no cache exists, and either there's no network connection or a server error, an exception is thrown with a message indicating work cannot continue.
projectName | The name of the project |
version | The version of the project |
listener | A completion listener. If this is null, no work will be done. |
Implements IProjectProvider.
void getVariant | ( | final String | projectName, |
final String | variantName, | ||
final String | version, | ||
final ICompletionListener< File > | listener | ||
) |
Returns the directory containing the variant files. If the variant files already exist in the provided IBundleCacheProvider, those will be used.
If no cache version exists, the network connection is checked. If a network connection exists, a server call is attempted. If the files are acquired from the server, they are cached and returned.
If no cache exists, and either there's no network connection or a server error, an exception is thrown with a message indicating work cannot continue.
projectName | The name of the project |
variantName | The name of the variant |
version | The version of the variant (this should match the same version string retrieved from getHighestVersion(String, String, ICompletionListener) |
listener | A completion listener. If this is null, no work will be done. |
Implements IProjectProvider.
void loadAllVariantsForProject | ( | final String | projectName, |
final ICompletionListener< Void > | listener | ||
) |
Loads all the variants for a given project. This method uses the SdkVersion#getSdkVersion() when calling getHighestVersion(String, String, ICompletionListener). Subsequently, it retrieves the project files, and uses the contained variants list to download each variant.
If a variant already exists in the provided IBundleCacheProvider, it will not be re-downloaded.
projectName | The name of the project to load |
listener | A listener to call when loading is complete. The type argument is Void because no object is returned. |
|
protected |
void setCertificateValidatorListener | ( | CertificateValidatorListener | certificateValidatorListener | ) |
Sets the SSL certificate validator listener.
The listener receives certificate validation challenges in response to an authentication request from the Kofax Quick Updater instance.
certificateValidatorListener |
void setRequestTimeout | ( | long | duration, |
TimeUnit | timeUnit | ||
) |
Change the connection timeout.
This parameter corresponds to all connection timeouts: connect, read and write. If any operation exceeds the timeout, the process is cancelled, and an exception will be raised.
Note: This sets the timeout for new connections. A value of 0 means no timeout, otherwise values must be between 1 and Integer::MAX_VALUE when converted to milliseconds.
duration | The amount of the timeout |
timeUnit | The time unit associated with the duration |
IllegalArgumentException |