Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Page Properties
hiddentrue

Status

Status
colourYellow
titlefor review

Approver

Alpar Szotyori (Unlicensed)

...

Table of Contents

We use the term file import to refer to the Open with feature within Gini Bank SDK. From the point of view of the SDK, files are imported into the SDK from an outside source. It is unaware and can't set configuration related to enabling the client app to receive files via Android’s Open with or Share functionality.

To enable file import, pass true to GiniBank.setCaptureConfiguration(CaptureConfiguration(fileImportEnabled = )). Additionally, your app should declare intent filters for receiving images and/or PDF files from other apps and then forward the incoming intent to Gini Bank SDK.

...

Register image and PDF file types

Add the following intent filter to the activity in your AndroidManifest.xml to receive incoming images and PDF files:

Code Block
languagexml
<activity android:name=".ui.MyActivity">
    <!-- Receiving images: -->
    <intent-filter
        android:label="@string/label_for_image_open_with">
        <action android:name="android.intent.action.VIEW" />
        <action android:name="android.intent.action.SEND" />
        <!-- The below SEND_MULTIPLE action is only needed if you enabled scanning of multi-page documents: -->
        <action android:name="android.intent.action.SEND_MULTIPLE" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="image/*" />
    </intent-filter>
    <!-- Receiving pdfs: -->
    <intent-filter
        android:label="@string/label_for_pdf_open_with">
        <action android:name="android.intent.action.VIEW" />
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="application/pdf" />
    </intent-filter>
</activity>

We recommend adding ACTION_VIEW to the intent filter to let users send images and PDF files to your app from apps that don’t implement sharing with ACTION_SEND but enable viewing images and PDF files with other apps.

Handle imported files

When your app is requested to handle an image or a PDF file, your activity (declaring the intent filter shown above) is launched or resumed (onNewIntent()) with the Intent having ACTION_VIEW or ACTION_SEND.

We recommend checking whether the Intent has the required action before proceeding with it:

Code Block
languagekotlin
String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_SEND.equals(action)) {
    ...
}

If the Intent passes the above check then register an activity result handler with the CaptureFlowImportContract() and pass the incoming intent Intent to GiniBank.startCaptureFlowForIntent():

...