Page Properties | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
|
We recommend using Capture Flow with Fragments instead of activities.
In order to launch Gini Capture SDK, follow these steps:
Request camera access.
Configure a new instance of
GiniCapture
.Launch
CameraActivity
.Handle the extraction results.
Send the final transfer summary values to Gini by calling
GiniCapture.sendTransferSummary()
method which will be used to improve the future extraction accuracyClean up the SDK by calling
GiniCapture.cleanup()
while also providing the required extraction feedback to improve future extraction accuracy. Follow the recommendations below which will release the resources used by SDK.
Follow these recommendations:
Note |
---|
|
You don’t need to implement any extra steps.
...
The diagram below shows the interaction between your app and the SDK:
Drawio | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Info |
---|
Check out an example app to see how an integration could can look like. |
The CameraActivity
returns one of the following results:
...
Learn how to launch Gini Capture SDK and handle the results from the example below:
Code Block | ||
---|---|---|
| ||
void launchGiniCapturestartGiniCaptureSDK() { // Make sure camera permission has been already granted at this point. // Check that the device fulfills the requirements. RequirementsReport report = GiniCaptureRequirements.checkRequirements((Context) this); if (!report.isFulfilled()) { handleUnfulfilledRequirements(report); return; } // Instantiate the networking implementations. GiniCaptureNetworkService networkService = ... // Configure GiniCapture and create a new singleton instance. GiniCapture.newInstance() .setGiniCaptureNetworkService(networkService) ... .build(); // Launch the CameraActivity and wait for the result. Intent intent = new Intent(this, CameraActivity.class); startActivityForResult(intent, GINI_CAPTURE_REQUEST); } @Override protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == GINI_CAPTURE_REQUEST) { switch (resultCode) { case Activity.RESULT_CANCELED: GiniCapture.cleanup(this, "", "", "", "","", Amount.EMPTY); break; case Activity.RESULT_OK: // Retrieve the extractions Bundle extractionsBundle = data.getBundleExtra( CameraActivity.EXTRA_OUT_EXTRACTIONS); // Retrieve the extractions from the extractionsBundle Map<String, GiniCaptureSpecificExtraction> extractions = new HashMap<>(); for (String extractionLabel : extractionsBundle.keySet()) { GiniCaptureSpecificExtraction extraction = extractionsBundle.getParcelable(extractionLabel); extractions.put(extractionLabel, extraction); } handleExtractionsshowExtractions(extractions); break; case CameraActivity.RESULT_ERROR: // Something went wrong, retrieve and handle the error final GiniCaptureError error = data.getParcelableExtra( CameraActivity.EXTRA_OUT_ERROR); if (error != null) { handleError(error); } GiniCapture.cleanup(this, "", "",); break; "", "","", Amount.EMPTY); case CameraActivity.RESULT_ENTER_MANUALLY: breakhandleEnterManually(); case CameraActivity.RESULT_ENTER_MANUALLY:GiniCapture.cleanup(this); handleEnterManually()break; } } } void GiniCapture.cleanup(this, "", "",stopGiniCaptureSDKWithTransferSummary(String paymentRecipient, String paymentReference, String paymentPurpose, "", "","", Amount.EMPTY); String iban, String bic, break; } }Amount }amount void stopGiniCaptureSDK() { // After the user has seen and potentially corrected the extractions, send the final // cleanup the SDK// whiletransfer passing in the final extraction summary values to Gini // which will be used as feedback to improve the future extraction accuracy: GiniCapture.cleanup(sendTransferSummary(Context) this, paymentRecipient, paymentReference, paymentPurpose, iban, bic, amount ) // cleanup the capture SDK after sending the transfer summary GiniCapture.cleanup(this) } |