Skip to content

Commit 5afb915

Browse files
update to 10.4.2003
1 parent 8c4ede6 commit 5afb915

File tree

707 files changed

+1942
-8703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

707 files changed

+1942
-8703
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ xcuserdata/
2525
*.dSYM
2626
iOSInjectionProject/
2727
project.xcworkspace
28+
*.xcframework
29+
*.xcworkspacedata
2830

2931
## Android specific
3032
android/HelloWorld/.idea/
31-
android/.idea/
33+
android/.idea/
34+
android/HelloWorld/OOB-UI-Barcode/libs
35+
android/HelloWorld/QuickStartBarcodeScanner/libs

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
License Notice
22

3-
This folder contains code samples ("Sample Code") for use with Dynamsoft Barcode Reader, a commercial software development kit licensed by Dynamsoft. The Sample Code may be modified and included in your end user software under the terms of the Dynamsoft Software License Agreement https://www.dynamsoft.com/company/license-agreement/ ("Commercial License"). Except as expressly stated in the Commercial License, no other rights are granted in the Sample Code. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3+
This folder contains code samples ("Sample Code") for use with Dynamsoft Barcode Reader, a commercial software development kit licensed by Dynamsoft. The Sample Code may be modified and included in your end user software under the terms of the Dynamsoft Software License Agreement https://www.dynamsoft.com/barcode-reader/license-agreement/ ("Commercial License"). Except as expressly stated in the Commercial License, no other rights are granted in the Sample Code. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44

55
Copyright © 2003–2024 Dynamsoft. All rights reserved.

README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ This repository contains multiple samples that demonstrate how to use the [Dynam
55
- User Guide
66
- [Android](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/user-guide.html)
77
- [iOS](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/objectivec-swift/user-guide.html?lang=swift)
8-
- API Reference
9-
- [Android](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/)
10-
- [iOS](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/objectivec-swift/api-reference/)
118

129
## Requirements
1310

@@ -23,27 +20,39 @@ This repository contains multiple samples that demonstrate how to use the [Dynam
2320
- Supported ABI: **arm64** and **x86_64**.
2421
- Development Environment: Xcode 13 and above (Xcode 14.1+ recommended), CocoaPods 1.11.0+
2522

26-
## Add the SDKs
23+
## Samples
2724

28-
- [Android](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/user-guide.html)
29-
- [iOS](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/objectivec-swift/user-guide.html?lang=swift#add-the-sdk)
25+
### BarcodeScanner API Samples
3026

31-
## Samples
27+
These samples show you how to implement barcode scanning by calling a ready-to-use UI, **BarcodeScanner**. The samples are designed to be low-code.
3228

33-
### Barcode Reader Samples
29+
| Sample Name | Description | Programming Language(s) |
30+
| ----------- | ----------- | ----------------------- |
31+
| `ScanSingleBarcode` | This sample shows how to the **BarcodeScanner** to scan and returns a singe barcode result. | Java(Android)/Kotlin/Objective-C/Swift |
32+
33+
- API Reference
34+
- [Android](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/barcode-scanner/)
35+
- [iOS](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/objectivec-swift/api-reference/barcode-scanner/)
36+
37+
### Foundational API Samples
38+
39+
High-level customization is available via the foundational APIs. These samples show you how to access the full feature of the foundational **DynamsoftBarcodeReader** SDK.
3440

3541
| Sample Name | Description | Programming Language(s) |
3642
| ----------- | ----------- | ----------------------- |
37-
| `DecodeWithCameraEnhancer` | The simplest sample of video streaming barcode scanner using **DynamsoftCameraEnhancer** as the input source. | Java(Android)/Kotlin/Objective-C/Swift |
38-
| `DecodeWithCameraX` | The video streaming barcode scanner sample, but using **CameraX** as the input source. | Java(Android)/Kotlin |
39-
| `DecodeWithAVCaptureSession` | The video streaming barcode scanner sample, but using **AVCaptureSession** as the input source. | Objective-C/Swift |
40-
| `DecodeFromAnImage` | The sample shows how to pick an image from the album for barcode decoding. | Java(Android)/Kotlin/Objective-C/Swift |
41-
| `DecodeMultipleBarcodes` | The sample shows how to efficiently decode multiple barcodes. | Java(Android)/Swift |
43+
| `DecodeWithCameraEnhancer` | The simplest sample of video streaming barcode scanner using **DynamsoftCameraEnhancer** as the input source. | Java(Android)/Swift |
44+
| `DecodeWithCameraX` | The video streaming barcode scanner sample, but using **CameraX** as the input source. | Java(Android) |
45+
| `DecodeWithAVCaptureSession` | The video streaming barcode scanner sample, but using **AVCaptureSession** as the input source. | Swift |
46+
| `DecodeFromAnImage` | The sample shows how to pick an image from the album for barcode decoding. | Java(Android)/Swift |
47+
| `DecodeMultipleBarcodes` | This sample shows how to efficiently decode multiple barcodes from the video stream. | Java(Android)/Swift |
4248
| `GeneralSettings` | Displays general barcode decoding settings and camera settings like barcode formats, expected barcode count and scan region settings. The default scan mode is continuous scanning. | Java(Android)/Swift |
43-
| `PerformanceSettings` | Parameter configuration guide on improving the speed, read-rate and accuracy of barcode reading. The sample includes the code of image decoding from the album. | Java(Android)/Swift |
44-
| `LocateAnItemWithBarcode` | The sample shows you how to locate an target barcode from multiple barcodes. | Java(Android)/Swift |
49+
| `LocateAnItemWithBarcode` | Input an ID with barcode text and detect it from multiple barcodes under the screen. | Java(Android)/Swift |
4550
| `TinyBarcodeDecoding` | The sample to tell you how to process the tiny barcodes. Including zoom and focus control. | Java(Android)/Swift |
4651

52+
- API Reference
53+
- [Android](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/)
54+
- [iOS](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/objectivec-swift/api-reference/)
55+
4756
### Capture Vision Samples
4857

4958
The following samples aggregate multiple products under `DynamsoftCaptureVision` architecture. They include the barcode decoding feature and implement it in more specific usage scenarios with the help of the other Dynamsoft functional products.

android/HelloWorld/.gitignore renamed to android/BarcodeScannerAPISamples/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
*.iml
22
.gradle
33
/local.properties
4-
/.idea
4+
/.idea/
55
.DS_Store
66
/build
77
/captures

android/DecodeMultipleBarcodes/DecodeMultipleBarcodes/.gitignore renamed to android/BarcodeScannerAPISamples/ScanSingleBarcode/.gitignore

File renamed without changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
plugins {
2+
id 'com.android.application'
3+
}
4+
5+
android {
6+
namespace 'com.dynamsoft.scansinglebarcode'
7+
compileSdk 33
8+
9+
defaultConfig {
10+
applicationId "com.dynamsoft.scansinglebarcode"
11+
minSdk 21
12+
targetSdk 33
13+
versionCode 1
14+
versionName "1.0"
15+
}
16+
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21+
}
22+
}
23+
compileOptions {
24+
sourceCompatibility JavaVersion.VERSION_1_8
25+
targetCompatibility JavaVersion.VERSION_1_8
26+
}
27+
}
28+
29+
dependencies {
30+
implementation 'com.dynamsoft:dynamsoftbarcodereaderbundle:10.4.2003'
31+
32+
implementation 'androidx.appcompat:appcompat:1.6.1'
33+
implementation 'com.google.android.material:material:1.9.0'
34+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
35+
}

android/DecodeMultipleBarcodes/DecodeMultipleBarcodes/proguard-rules.pro renamed to android/BarcodeScannerAPISamples/ScanSingleBarcode/proguard-rules.pro

File renamed without changes.

android/HelloWorld/DecodeWithCameraXKt/src/main/AndroidManifest.xml renamed to android/BarcodeScannerAPISamples/ScanSingleBarcode/src/main/AndroidManifest.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
33

4-
<uses-feature
5-
android:name="android.hardware.camera"
6-
android:required="false" />
7-
<uses-permission android:name="android.permission.CAMERA"/>
8-
94
<application
105
android:allowBackup="true"
11-
android:icon="@drawable/dbr_icon"
6+
android:icon="@mipmap/ic_launcher"
127
android:label="@string/app_name"
13-
android:roundIcon="@drawable/dbr_icon"
8+
android:roundIcon="@mipmap/ic_launcher_round"
149
android:supportsRtl="true"
15-
android:theme="@style/Theme.HelloWorld_DBR">
10+
android:theme="@style/Theme.HelloWorld_DBR" >
11+
1612
<activity
1713
android:name=".MainActivity"
1814
android:exported="true">
@@ -22,6 +18,7 @@
2218
<category android:name="android.intent.category.LAUNCHER" />
2319
</intent-filter>
2420
</activity>
21+
2522
</application>
2623

2724
</manifest>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"CaptureVisionTemplates": [
3+
{
4+
"Name": "ReadSingleBarcode",
5+
"ImageROIProcessingNameArray": [
6+
"roi_read_single_barcode"
7+
],
8+
"Timeout": 200,
9+
"MaxParallelTasks":0
10+
}
11+
],
12+
"TargetROIDefOptions": [
13+
{
14+
"Name": "roi_read_single_barcode",
15+
"TaskSettingNameArray": [
16+
"task_read_single_barcode"
17+
]
18+
}
19+
],
20+
"BarcodeReaderTaskSettingOptions": [
21+
{
22+
"Name": "task_read_single_barcode",
23+
"ExpectedBarcodesCount":1,
24+
"LocalizationModes": [
25+
{
26+
"Mode": "LM_SCAN_DIRECTLY",
27+
"ScanDirection": 2
28+
},
29+
{
30+
"Mode": "LM_CONNECTED_BLOCKS"
31+
}
32+
],
33+
"DeblurModes":[
34+
{
35+
"Mode": "DM_BASED_ON_LOC_BIN"
36+
},
37+
{
38+
"Mode": "DM_THRESHOLD_BINARIZATION"
39+
},
40+
{
41+
"Mode": "DM_DEEP_ANALYSIS"
42+
}
43+
],
44+
"SectionImageParameterArray": [
45+
{
46+
"Section": "ST_REGION_PREDETECTION",
47+
"ImageParameterName": "ip_read_single_barcode"
48+
},
49+
{
50+
"Section": "ST_BARCODE_LOCALIZATION",
51+
"ImageParameterName": "ip_read_single_barcode"
52+
},
53+
{
54+
"Section": "ST_BARCODE_DECODING",
55+
"ImageParameterName": "ip_read_single_barcode"
56+
}
57+
]
58+
}
59+
],
60+
"ImageParameterOptions": [
61+
{
62+
"Name": "ip_read_single_barcode",
63+
"TextDetectionMode": {
64+
"Mode": "TTDM_LINE",
65+
"Direction": "UNKNOWN",
66+
"Sensitivity": 3
67+
},
68+
"IfEraseTextZone": 1,
69+
"BinarizationModes": [
70+
{
71+
"Mode": "BM_LOCAL_BLOCK",
72+
"BlockSizeX": 39,
73+
"BlockSizeY": 39,
74+
"EnableFillBinaryVacancy": 0
75+
}
76+
]
77+
}
78+
]
79+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package com.dynamsoft.scansinglebarcode;
2+
3+
import android.os.Bundle;
4+
import android.widget.TextView;
5+
6+
import com.dynamsoft.dbrbundle.ui.BarcodeScanResult;
7+
import com.dynamsoft.dbrbundle.ui.BarcodeScannerActivity;
8+
import com.dynamsoft.dbrbundle.ui.BarcodeScannerConfig;
9+
import com.dynamsoft.core.basic_structures.DSRect;
10+
11+
import androidx.activity.result.ActivityResultLauncher;
12+
import androidx.annotation.Nullable;
13+
import androidx.appcompat.app.AppCompatActivity;
14+
15+
/**
16+
* @author: dynamsoft
17+
* Time: 2024/9/29
18+
* Description:
19+
*/
20+
public class MainActivity extends AppCompatActivity {
21+
private ActivityResultLauncher<BarcodeScannerConfig> launcher;
22+
23+
@Override
24+
protected void onCreate(@Nullable Bundle savedInstanceState) {
25+
super.onCreate(savedInstanceState);
26+
setContentView(R.layout.activity_main);
27+
28+
TextView textView = findViewById(R.id.tv_result);
29+
30+
BarcodeScannerConfig config = new BarcodeScannerConfig();
31+
32+
/*
33+
Initialize the license.
34+
The license string here is a trial license. Note that network connection is required for this license to work.
35+
You can request an extension via the following link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=android
36+
*/
37+
config.setLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9");
38+
39+
// You can use the following code to specify the barcode format. If you are using a template file, the "BarcodeFormat" can also be specified via the template file.
40+
//config.setBarcodeFormats(EnumBarcodeFormat.BF_ONED | EnumBarcodeFormat.BF_QR_CODE);
41+
// If you have a customized template file, please put it under "src\main\assets\Templates\" and call the following code.
42+
//config.setTemplateFilePath("ReadSingleBarcode.json");
43+
// The following settings will display a scan region on the view. Only the barcode in the scan region can be decoded.
44+
//config.setScanRegion(new DSRect(0.15f, 0.3f, 0.85f, 0.7f, true));
45+
// Uncomment the following line to disable the beep sound.
46+
//config.setBeepEnabled(false);
47+
// Uncomment the following line if you don't want to display the torch button.
48+
// config.setTorchButtonVisible(false);
49+
// Uncomment the following line if you don't want to display the close button.
50+
// config.setCloseButtonVisible(false);
51+
// Uncomment the following line if you want to hide the scan laser.
52+
// config.setScanLaserVisible(false);
53+
// Uncomment the following line if you want the camera to auto-zoom when the barcode is far away.
54+
// config.setAutoZoomEnabled(false);
55+
56+
launcher = registerForActivityResult(new BarcodeScannerActivity.ResultContract(), result -> {
57+
if (result.getResultStatus() == BarcodeScanResult.EnumResultStatus.RS_FINISHED && result.getBarcodes() != null) {
58+
String content = "Result: format: " + result.getBarcodes()[0].getFormatString() + "\n" + "content: "
59+
+ result.getBarcodes()[0].getText();
60+
textView.setText(content);
61+
} else if (result.getResultStatus() == BarcodeScanResult.EnumResultStatus.RS_CANCELED) {
62+
textView.setText("Scan canceled.");
63+
}
64+
if (result.getErrorString() != null && !result.getErrorString().isEmpty()) {
65+
textView.setText(result.getErrorString());
66+
}
67+
});
68+
69+
findViewById(R.id.btn_navigate).setOnClickListener(v -> launcher.launch(config));
70+
}
71+
}

0 commit comments

Comments
 (0)