public interface GiniVisionNetworkService
The easiest way to get started is to use the Gini Vision Network Library package which provides a default implementation.
You can also create your own implementation and communicate directly with the Gini API or pass requests through your backend. For direct communication with the Gini API we recommend using the Gini API SDK.
In order for the Gini Vision Library to use your implementation pass an instance of it to
GiniVision.Builder#setGiniVisionNetworkService(GiniVisionNetworkService)
when creating a
GiniVision
instance.
When an instance of this interface is available document analysis related methods in the
CameraFragmentListener
, ReviewFragmentListener
and the AnalysisFragmentListener
won't be invoked. Otherwise the Gini Vision Library falls back to
invoking those methods.
Modifier and Type | Method and Description |
---|---|
CancellationToken |
analyze(java.util.LinkedHashMap giniApiDocumentIdRotationMap,
GiniVisionNetworkCallback callback)
Called when a document needs to be analyzed by the Gini API.
|
void |
cleanup()
Called when the Gini Vision Library is not needed anymore and the
GiniVision.cleanup(Context) method has been called. |
CancellationToken |
delete(java.lang.String giniApiDocumentId,
GiniVisionNetworkCallback callback)
Called when a document needs to be deleted from the Gini API.
|
CancellationToken |
upload(Document document,
GiniVisionNetworkCallback callback)
Called when a document needs to be uploaded to the Gini API.
|
CancellationToken upload(Document document, GiniVisionNetworkCallback callback)
You should only upload the document. Polling or retrieving extractions is not needed at this point.
document
- a Document
containing an image, pdf or other supported formatscallback
- a callback implementation to return the outcome of the uploadCancellationToken
to be used for requesting upload cancellationCancellationToken delete(java.lang.String giniApiDocumentId, GiniVisionNetworkCallback callback)
giniApiDocumentId
- id of the document received when it was uploaded to the Gini APIcallback
- a callback implementation to return the outcome of the deletionCancellationToken
to be used for requesting cancellation of the deletionCancellationToken analyze(java.util.LinkedHashMap giniApiDocumentIdRotationMap, GiniVisionNetworkCallback callback)
The documents were already uploaded and only the Gini API document ids of documents are passed in along with the user applied document rotations.
giniApiDocumentIdRotationMap
- a map of Gini API document ids and the user applied
document rotationscallback
- a callback implementation to return the outcome of the
analysisCancellationToken
to be used for requesting analysis cancellationvoid cleanup()
GiniVision.cleanup(Context)
method has been called.
Free up any resources your implementation is using.