Kofax Mobile SDK API Reference
|
Use the AppStatistics class for creating, saving, and exporting statistics related to SDK framework usage. More...
Classes | |
enum | AppStatsExportFormat |
Indicates the export format desired when calling the export method. More... | |
enum | ExportStatusEvent |
enum | ThresholdType |
Public Member Functions | |
int | getRamSizeThreshold () |
void | setRamSizeThreshold (int ramSizeThreshold) |
int | getFileSizeThreshold () |
void | setFileSizeThreshold (int fileSizeThreshold) |
long | getRamSize () |
Current size of available RAM. More... | |
long | getFileSize () throws FileNotFoundException |
String | getFileName () |
Returns the filename of the datastore where AppStats events are written. More... | |
String | getDeviceId () |
Returns the current DeviceID which is recorded as a field in the Environment table. More... | |
void | setDeviceId (String userDeviceID) |
Sets the current DeviceID which is recorded as a field in the Environment table. More... | |
ListenerCallbackThreadType | getListenerCallbackThreadType () |
Get the ListenerCallbackThreadType. More... | |
void | setListenerCallbackThreadType (ListenerCallbackThreadType listenerCallbackThreadType) |
Set the ListenerCallbackThreadType. More... | |
final synchronized void | initAppStats (String name) |
Initialize AppStats with database file name. More... | |
synchronized ErrorInfo | startRecord () |
Start recording app statistics, or continues recording. More... | |
synchronized ErrorInfo | stopRecord () |
Stop recording data while retaining data that has been collected. More... | |
synchronized ErrorInfo | writeToFile () |
Writes the in-memory statistics buffer to the AppStats database. More... | |
void | registerExportHandler (AppStatsDsExportHandler handler) |
The export method creates a SQL dump or other file format of the internal data store. More... | |
synchronized ErrorInfo | export (String exportFilePath, AppStatsExportFormat format) |
The export method creates a SQL dump or other file of the internal data store. More... | |
synchronized ErrorInfo | purge () |
The purge method erases the AppStats memory buffer and the AppStats recording database file. More... | |
boolean | isRecording () |
Returns the status, isRecording is set to true when startRecording is. More... | |
synchronized void | beginSession (String sessionKey, String category) |
This method tells appStats to start a "session". More... | |
synchronized void | logSessionEvent (AppStatsSessionEvent sessionEvent) |
This method allows the application a means of recording an application-defined Session event. More... | |
synchronized void | endSession (boolean success, String description) |
This method tells appStats to end a "session". More... | |
void | addAppStatsWriteFileListener (AppStatsWriteFileListener listener) |
Registers an event listener for the writeToFile method. More... | |
void | addAppStatsExportListener (AppStatsExportListener listener) |
Registers an event listener for the export method. More... | |
void | addAppThresholdListener (AppstatsThresholdReachedListener listener) |
Registers a threshold listener. More... | |
void | removeAppStatsExportListener (AppStatsExportListener listener) |
Removes an event listener for the export method. More... | |
void | removeAppStatsThresholdListener (AppstatsThresholdReachedListener listener) |
Removes an event listener for the threshold detection. More... | |
void | removeAppStatsWriteFileListener (AppStatsWriteFileListener listener) |
Removes an event listener for the writeToFile method. More... | |
Static Public Member Functions | |
static AppStatistics | getInstance () |
Protected Attributes | |
List< AppStatsDao > | appStatsDaoCurrent = appStatsDaoPrimary |
Use the AppStatistics class for creating, saving, and exporting statistics related to SDK framework usage.
void addAppStatsExportListener | ( | AppStatsExportListener | listener | ) |
Registers an event listener for the export method.
This method registers an event listener for the export method, so the application can be notified of progress and completion of the export operation.
void addAppStatsWriteFileListener | ( | AppStatsWriteFileListener | listener | ) |
Registers an event listener for the writeToFile method.
This method registers an event listener for the writeToFile method, so the application can be notified of progress and completion of the writeToFile operation.
void addAppThresholdListener | ( | AppstatsThresholdReachedListener | listener | ) |
Registers a threshold listener.
This method registers an event listener for appStats reaching threshold levels, so that each time memory or storage crosses the next threshold level in terms of storage space, this listener will be called.
synchronized void beginSession | ( | String | sessionKey, |
String | category | ||
) |
This method tells appStats to start a "session".
This method allows the application a means of recording an application-defined Session. Each session is a grouping in which all subsequent appStats operations will be logged with the same "sessionKey", until the next endSession call.
sessionKey | is an application-defined string, which will be a meaningful identifier for this session. This same sessionKey should also be passed to any server-side calls, such as RTTI, so stats collected on the server can reflect the same sessionKey. |
category | is an application-defined string, representing the type of session this represents. Examples of typical categories include CheckDeposit, BillPay, etc. |
synchronized void endSession | ( | boolean | success, |
String | description | ||
) |
This method tells appStats to end a "session".
This method tells appStats to stop the session. Subsequent logging calls will not include a sessionKey in the database, until the next time beginSession is called again.
success | should be set to true if the overall operation for this session, such as a check deposit, succeeded. Only the application can know overall success or not of a session. |
description | may be used to include helpful logging information, in case the session did not succeed. |
synchronized ErrorInfo export | ( | String | exportFilePath, |
AppStatsExportFormat | format | ||
) |
The export method creates a SQL dump or other file of the internal data store.
The contents of the database will be written to a sql dump file
String getDeviceId | ( | ) |
Returns the current DeviceID which is recorded as a field in the Environment table.
String getFileName | ( | ) |
Returns the filename of the datastore where AppStats events are written.
The writeToFile method will store data in a file with this name in the directory: /data/data/application_package_name/databases.
long getFileSize | ( | ) | throws FileNotFoundException |
The readonly fileSize variable is the current amount of flash memory used in the database. The database file was specified by the initAppStats method. After you call the purge method, this value is set to 0. The size of the file does not grow linearly, even after a few write to file calls, but this value gives you a relative size as statistical data is written to the data base.
int getFileSizeThreshold | ( | ) |
fileSizeThreshold is the size in bytes at which a warning will be issued to the application. The warning indicates the file size has reached the limit established by the application.
|
static |
This method returns a singleton object of AppStatistics.
ListenerCallbackThreadType getListenerCallbackThreadType | ( | ) |
Get the ListenerCallbackThreadType.
long getRamSize | ( | ) |
Current size of available RAM.
This readonly property keeps the current recording memory usage.
int getRamSizeThreshold | ( | ) |
Get the current ram threshold size
final synchronized void initAppStats | ( | String | name | ) |
Initialize AppStats with database file name.
This method is used to initialize and open the AppStats database file. If an existing database file is opened, this method checks to see if the database schema matches the current internal app stats schema version. If it does not, the database is silently deleted and recreated.
name | - name of the database file |
boolean isRecording | ( | ) |
Returns the status, isRecording is set to true when startRecording is.
Returns the recording status
synchronized void logSessionEvent | ( | AppStatsSessionEvent | sessionEvent | ) |
This method allows the application a means of recording an application-defined Session event.
Each Session event may represent a "sub-Session", or single operation which defines one step in a sequence of steps which collectively define a complete session. The logSessionEvent accepts as a parameter an AppStatsSessionEvent object.
sessionEvent | includes all the properties necessary to define a specific AppStats Session event. |
synchronized ErrorInfo purge | ( | ) |
The purge method erases the AppStats memory buffer and the AppStats recording database file.
The database file was specified by the initAppstats method. Recording must be disabled before calling this method. After this call, the library AppStats is set to an uninitialized state. You must call initAppStats again to begin another session. The purge method does not delete the SQL file that was created by the export method. Your app is responsible for consuming and controlling the export data file.
void registerExportHandler | ( | AppStatsDsExportHandler | handler | ) |
The export method creates a SQL dump or other file format of the internal data store.
The export method allows the user to either use the built-in handler for exporting data from the datastore, or the user can write a custom handler to write their own export functionality.
In order to write a custom handler write a class that implements AppStatsDsExportHandler, register the handler, while adding the listener make sure to choose the right export format type.
handler | - Custom handler |
void removeAppStatsExportListener | ( | AppStatsExportListener | listener | ) |
Removes an event listener for the export method.
This method removes an event listener for the export method.
void removeAppStatsThresholdListener | ( | AppstatsThresholdReachedListener | listener | ) |
Removes an event listener for the threshold detection.
This method removes an event listener for theshold detection.
void removeAppStatsWriteFileListener | ( | AppStatsWriteFileListener | listener | ) |
Removes an event listener for the writeToFile method.
This method removes an event listener for the writeToFile method.
void setDeviceId | ( | String | userDeviceID | ) |
Sets the current DeviceID which is recorded as a field in the Environment table.
The application is free to set any device-specific identifier. If no DeviceID is specified, a null or empty string value will be recorded and exported as the 'DeviceID' field in the Environment table.
void setFileSizeThreshold | ( | int | fileSizeThreshold | ) |
When the file reaches the threshold specified SizeThresholdReached event will be fired
fileSizeThreshold |
void setListenerCallbackThreadType | ( | ListenerCallbackThreadType | listenerCallbackThreadType | ) |
Set the ListenerCallbackThreadType.
Set the thread type for asynchronous callbacks. The application can choose whether to receive event callbacks on the worker thread used to record, write and export AppStats events, or on the main UI thread. The default value is ListenerCallbackThreadType.UI_THREAD.
void setRamSizeThreshold | ( | int | ramSizeThreshold | ) |
Each time a multiple of this threshold is met a SizeThresholdReached event will fire (0 turns off event triggering for file usage).
ramSizeThreshold |
synchronized ErrorInfo startRecord | ( | ) |
Start recording app statistics, or continues recording.
Use this method to start recording statistics during normal library operations. This will set the isRecording property to true, and open the SQLite database.\n
This method is only valid if you have initialized AppStats by calling initAppStats to create the database file.
synchronized ErrorInfo stopRecord | ( | ) |
Stop recording data while retaining data that has been collected.
Use this method to stop recording. This will set the isRecording property to false, and close the data repository to ensure anything in memory is flushed to the file system.
This method is only valid if you previously started recording.
synchronized ErrorInfo writeToFile | ( | ) |
Writes the in-memory statistics buffer to the AppStats database.
Use this asynchronous method from your thresholdReached delegate to periodically write the buffer to the database file. You may also call this method periodically while recording or after recording is turned off. This helps conserve memory. Writing AppStats data to memory improves performance.
If the database was closed, this method opens it first for writing, then closes it when finished. Else if open, the method keeps it open.
After the write is complete, the AppStats internal buffer is erased, and the filesize property may or may not increase, but reflects the size of the database file after the write completes.
|
protected |