Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/sdks/android/add-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ import ExternalDependencies from '../../partials/get-started/_external-deps-andr

Add _mavenCentral()_ repository in your _build.gradle_ file:

```java
```gradle
repositories {
mavenCentral()
}
```

See [Internal Dependencies](#internal-dependencies) to identify the artifacts needed based on your desired functionality. Then add the necessary dependencies to your app’s _build.gradle_ file:

```java
```gradle
dependencies {
implementation "com.scandit.datacapture:[dependency]:[version]"
}
Expand All @@ -76,7 +76,7 @@ You can find the latest version on [Sonatype](https://s01.oss.sonatype.org/conte

Add the _mavenCentral_ repository in _pom.xml_ file:

```java
```xml
<repositories>
<repository>
<snapshots>
Expand All @@ -91,7 +91,7 @@ Add the _mavenCentral_ repository in _pom.xml_ file:

See [Internal Dependencies](#internal-dependencies) to identify the artifacts needed based on your desired functionality. Then add the necessary dependencies:

```java
```xml
...

<dependency>
Expand All @@ -115,7 +115,7 @@ Depending on the data capture task, you also need to reference the specific modu

If your project already has a local `flatDir` repository, add the AAR files to that folder. If you do not have a `flatDir` repository yet, create a new one in your _build.gradle_ file as illustrated below:

```java
```gradle
repositories {
flatDir {
dirs '/path/to/folder/containing/the/aar/file'
Expand All @@ -125,7 +125,7 @@ repositories {

Add the .aar libraries as dependencies to your `build.gradle` file:

```java
```gradle
dependencies {
api(name:'ScanditBarcodeCapture', ext:'aar')
}
Expand Down
3 changes: 1 addition & 2 deletions docs/sdks/android/agents-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ val dataCaptureContext = DataCaptureContext.forLicenseKey(BuildConfig.SCANDIT_LI

Java:
```java
import com.scandit.datacapture.core.DataCaptureContext;

import com.scandit.datacapture.core.capture.DataCaptureContext;
DataCaptureContext dataCaptureContext =
DataCaptureContext.forLicenseKey(BuildConfig.SCANDIT_LICENSE_KEY);
```
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/android/barcode-capture/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void onBarcodeScanned(
@NonNull BarcodeCaptureSession session,
@NonNull FrameData frameData
) {
List<Barcode> recognizedBarcodes = session.getNewlyRecognizedBarcode();
Barcode recognizedBarcode = session.getNewlyRecognizedBarcode();
// Do something with the barcodes. See Rejecting Barcodes, below, for an example.
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/android/barcode-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ You can configure the colors used in the resulting image:

```java
DataCaptureContext dataCaptureContext = DataCaptureContext.forLicenseKey(licenseKey);
BarcodeGenerator.Code128BarcodeGeneratorBuilder builder = new BarcodeGenerator.code128BarcodeGeneratorBuilder(dataCaptureContext)
BarcodeGenerator.Code128BarcodeGeneratorBuilder builder = BarcodeGenerator.code128BarcodeGeneratorBuilder(dataCaptureContext)
.withBackgroundColor(Color.WHITE)
.withForegroundColor(Color.BLACK);
```
Expand Down
16 changes: 8 additions & 8 deletions docs/sdks/android/id-capture/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ There are several advanced configurations that can be used to customize the beha
By default, ID Capture doesn’t extract data from the table on the back of European Driver Licenses. If you are interested in this data, you may enable the extraction by calling:

```java
settings.decodeBackOfEuropeanDrivingLicenses();
settings.setDecodeBackOfEuropeanDrivingLicense(true);
```

:::warning
Expand All @@ -32,16 +32,16 @@ That means certain data from certain fields won’t be returned, even if it’s

```java
// Default value:
settings.setAnyonymizationMode(IdAnonymizationMode.FIELDS_ONLY);
settings.setAnonymizationMode(IdAnonymizationMode.FIELDS_ONLY);

// Sensitive data is additionally covered with black boxes on returned images:
settings.setAnyonymizationMode(IdAnonymizationMode.FIELDS_AND_IMAGES);
settings.setAnonymizationMode(IdAnonymizationMode.FIELDS_AND_IMAGES);

// Only images are anonymized:
settings.setAnyonymizationMode(IdAnonymizationMode.IMAGES_ONLY);
settings.setAnonymizationMode(IdAnonymizationMode.IMAGES_ONLY);

// No anonymization:
settings.setAnyonymizationMode(IdAnonymizationMode.NONE);
settings.setAnonymizationMode(IdAnonymizationMode.NONE);
```

## ID Images
Expand All @@ -57,13 +57,13 @@ For the full frame of the document, you can use [`setShouldPassImageTypeToResult

```java
// Holder's picture as printed on a document:
settings.setShouldPassImageTypeToResult(ImageType.FACE);
settings.setShouldPassImageTypeToResult(IdImageType.FACE, true);

// Cropped image of a document:
settings.setShouldPassImageTypeToResult(ImageType.CROPPED_DOCUMENT);
settings.setShouldPassImageTypeToResult(IdImageType.CROPPED_DOCUMENT, true);

// Full camera frame that contains the document:
settings.setShouldPassImageTypeToResult(ImageType.FULL_FRAME);
settings.setShouldPassImageTypeToResult(IdImageType.FRAME, true);
```

## Callbacks and Scanning Workflows
Expand Down
76 changes: 38 additions & 38 deletions docs/sdks/android/id-capture/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,57 +101,57 @@ By default, [anonymized data](./advanced.md#configure-data-anonymization) is not
:::

```java
List<DocumentType> acceptedDocuments = new ArrayList();
List<DocumentType> rejectedDocuments = new ArrayList();
List<IdCaptureDocument> acceptedDocuments = new ArrayList<>();
List<IdCaptureDocument> rejectedDocuments = new ArrayList<>();

// Documents from any region:
acceptedDocuments.add(new IdCard(Region.AnyRegion));
acceptedDocuments.add(new IdCard(IdCaptureRegion.ANY));
// Only documents issued by a specific country:
acceptedDocuments.add(new IdCard(Region.Germany));
acceptedDocuments.add(new IdCard(IdCaptureRegion.GERMANY));
// Regional documents:
acceptedDocuments.add(new RegionSpecific.ApecBusinessTravelCard());
acceptedDocuments.add(new RegionSpecific(RegionSpecificSubtype.APEC_BUSINESS_TRAVEL_CARD));
// Reject passports from certain regions:
rejectedDocuments.add(new Passport(Region.Cuba));
rejectedDocuments.add(new Passport(IdCaptureRegion.CUBA));

IdCaptureSettings settings = new IdCaptureSettings();
settings.acceptedDocuments = acceptedDocuments;
settings.rejectedDocuments = rejectedDocuments;
settings.setAcceptedDocuments(acceptedDocuments);
settings.setRejectedDocuments(rejectedDocuments);

// To scan only one-sided documents and a given zone:
settings.scannerType = new SingleSideScanner(barcode = true);
// or
settings.scannerType = new SingleSideScanner(machineReadableZone = true);
// or
settings.scannerType = new SingleSideScanner(visualInspectionZone = true);
settings.setScanner(new IdCaptureScanner(new SingleSideScanner(
true, // barcode
true, // machineReadableZone
true // visualInspectionZone
), null));

// To scan both sides of the document:
settings.scannerType = new FullDocumentScanner();
settings.setScanner(new IdCaptureScanner(new FullDocumentScanner(), null));
```

Create a new ID Capture mode with the chosen settings:

```java
IdCapture idCapture = IdCapture.forDataCaptureContext(context, settings);
IdCapture idCapture = IdCapture.forDataCaptureContext(dataCaptureContext, settings);
```

## Implement a Listener

To receive scan results, implement and [IdCaptureListener](https://docs.scandit.com/data-capture-sdk/android/id-capture/api/id-capture-listener.html#interface-scandit.datacapture.id.IIdCaptureListener). The listener provides two callbacks: `onIdCaptured` and `onIdRejected`.

```java
IdCaptureListener listener = new IdCaptureListner() {
IdCaptureListener listener = new IdCaptureListener() {
@Override
public void onIdCaptured(CapturedId data) {
// Success! Handle extracted data here.
}

public void onIdCaptured(@NonNull IdCapture idCapture, @NonNull CapturedId capturedId) {
// Success! Handle extracted data here.
}
@Override
public void onIdRejected(CapturedId data, RejectionReason reason) {
// Something went wrong. Inspect the reason to determine the follow-up action.
public void onIdRejected(@NonNull IdCapture idCapture, @Nullable CapturedId capturedId, @NonNull RejectionReason rejectionReason) {
// Something went wrong. Inspect the reason to determine the follow-up action.
}
}
};

idCapture.setListener(listener);
idCapture.addListener(listener);
```

### Handling Success
Expand All @@ -164,14 +164,14 @@ On a successful scan you may read the extracted data from `CapturedId`:

```java
@Override
public void onIdCaptured(CapturedId data) {
String fullName = data.getFullName();
DateResult dateOfBirth = data.getDateOfBirth();
DateResult dateOfExpiry = data.getDateOfExpiry();
String documentNumber = data.getDocumentNumber();
public void onIdCaptured(@NonNull IdCapture idCapture, @NonNull CapturedId capturedId) {
String fullName = capturedId.getFullName();
DateResult dateOfBirth = capturedId.getDateOfBirth();
DateResult dateOfExpiry = capturedId.getDateOfExpiry();
String documentNumber = capturedId.getDocumentNumber();

// Process data:
processData(fullName, dateOfBirth, dateOfExpiry, documentNumber);
processData(fullName, dateOfBirth, dateOfExpiry, documentNumber);
}
```
:::tip
Expand All @@ -186,14 +186,14 @@ You may wish to implement the follow-up action based on the reason of failure:

```java
@Override
public void onIdRejected(CapturedId data, RejectionReason reason) {
if (reason == RejectionReason.Timeout) {
// Ask the user to retry, or offer alternative input method.
} else if (reason == RejectionReason.DocumentExpired) {
// Ask the user to provide alternative document.
} else if (reason == RejectionReason.HolderUnderage) {
// Reject the process.
}
public void onIdRejected(@NonNull IdCapture idCapture, @Nullable CapturedId capturedId, @NonNull RejectionReason rejectionReason) {
if (rejectionReason == RejectionReason.TIMEOUT) {
// Ask the user to retry, or offer alternative input method.
} else if (rejectionReason == RejectionReason.DOCUMENT_EXPIRED) {
// Ask the user to provide alternative document.
} else if (rejectionReason == RejectionReason.HOLDER_UNDERAGE) {
// Reject the process.
}
}
```

Expand Down
Loading