Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
35f6c04
add document enhancer classic example module
Mar 25, 2026
46705c0
add document enhancer public doc snippet
Mar 25, 2026
e5a24d4
add image enhancer snippets
Mar 27, 2026
12c4ce2
cleanup
Mar 31, 2026
9d9764f
cleanup
Mar 31, 2026
9560128
Add rtu enhancer config snippet
Apr 1, 2026
de1fddb
fix compiling
Apr 1, 2026
7749beb
Merge pull request #422 from doo/sc/SB-20572_image_enhanser
SerhiiChaban-apryse Apr 20, 2026
fdb7bad
cleanup examples
Apr 21, 2026
517d7c0
9.0.0.109-STAGING-SNAPSHOT
Apr 29, 2026
7e9930b
Merge pull request #426 from doo/sc/SB-20828_update_examples
SerhiiChaban-apryse Apr 30, 2026
8325f48
9.0.0.111-STAGING-SNAPSHOT
May 5, 2026
ebd9138
fix compose app compiling
May 5, 2026
58a7d76
add simplified snippet examples
May 11, 2026
03a24f6
fix document enhancer classic module
May 18, 2026
c07db32
update file provider config
May 18, 2026
fee5770
Merge branch 'master' into android_ds_9.0.0
May 21, 2026
7cf1f0a
cleanup pr
May 21, 2026
55097f5
cleanup gradle
May 21, 2026
7f2dd6c
code cleanup and updated SDK version to 9.0.0.1199-SNAPSHOT
kubiria-apryse Jun 1, 2026
7599eb6
Fixed Document Enhancer example on the imported image
kubiria-apryse Jun 1, 2026
69f4915
Merge pull request #428 from doo/ak/sb-21245
SerhiiChaban-apryse Jun 9, 2026
740ca6a
Merge pull request #427 from doo/ak/sb-21244
SerhiiChaban-apryse Jun 9, 2026
ebb10b7
9.0.0.1200-SNAPSHOT
Jun 9, 2026
0c94399
SB-21247 fix flash buttons barcode usecase
Jun 10, 2026
5baaa0c
fixed lint layout issue in scanbot-sdk-example-android/classic-compon…
kubiria-apryse Jun 10, 2026
3ddf221
update examples aspect ratio to credit card
Jun 10, 2026
03b3144
SB-21249 fix tiff example custom fields
Jun 10, 2026
d0d57b7
Merge pull request #429 from doo/ak/sb-21333
SerhiiChaban-apryse Jun 10, 2026
59e556c
Updated SDK to 9.0.0.1206-SNAPSHOT
kubiria-apryse Jun 15, 2026
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
2 changes: 1 addition & 1 deletion Libraries.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Open Source libraries used in the Scanbot SDK for Android version 8.1.0
Open Source libraries used in the Scanbot SDK for Android version 9.0.0

CWAC-Camera

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Make sure you have the latest stable version of [Android Studio](https://develop

2. There are 4 separate folders with standalone examples:

* **classic-components-example**: Example project for the Scanbot SDK Classic Components which allow for full customization.
* **classic-components-example**: Example project for the Scanbot SDK Classic Components which allow for full customization.
* **compose-custom-ui-example**: Example project for the Scanbot SDK Compose Custom Components which allow for full customization.
* **document-scanner-ready-to-use-ui-example:** Example project for the Scanbot Document Scanner SDK using our Ready-To-Use UI components.
* **data-capture-ready-to-use-ui-example**: Example project showcasing the Scanbot Data Capture Modules using our Ready-to-Use UI components.
Expand Down
11 changes: 11 additions & 0 deletions classic-components-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Scanbot SDK Classic Components examples

This project contains multiple standalone Android app modules demonstrating the Scanbot SDK Classic Components. Each module can be opened and run on its own. The only shared code lives in the `common` module.

## How to run a module

1. Open `scanbot-sdk-example-android/classic-components-example` in Android Studio.
2. Sync Gradle.
3. Choose one module in the **Run** configuration (each module is an `application`).
4. Add your Scanbot SDK license key in the module’s `ExampleApplication` or stay on demo mode.
5. Run the app on a device or emulator.
8 changes: 3 additions & 5 deletions classic-components-example/adjustable-filters/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@ android {

buildTypes {
named("debug") {
// set this to `false` to allow debugging and run a "non-release" build

minifyEnabled = false
debuggable = true
}
}

kotlin {
jvmToolchain(project.ext.jvmToolchainVersion)
}

buildFeatures {
viewBinding = true
}
}

kotlin.jvmToolchain(project.ext.jvmToolchainVersion)

dependencies {
implementation(project(':common'))
implementation("androidx.appcompat:appcompat:${project.ext.androidxAppcompatVersion}")
Expand Down
21 changes: 0 additions & 21 deletions classic-components-example/adjustable-filters/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import io.scanbot.sdk.imageprocessing.ParametricFilter
import kotlinx.coroutines.*

/**
Ths example uses new sdk APIs presented in Scanbot SDK v.8.x.x
Please, check the official documentation for more details:
This example uses the SDK APIs introduced in Scanbot SDK v8.x.x.
Please check the official documentation for more details:
Result API https://docs.scanbot.io/android/document-scanner-sdk/detailed-setup-guide/result-api/
ImageRef API https://docs.scanbot.io/android/document-scanner-sdk/detailed-setup-guide/image-ref-api/
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
/**
Ths example uses new sdk APIs presented in Scanbot SDK v.8.x.x
Please, check the official documentation for more details:
This example uses the SDK APIs introduced in Scanbot SDK v8.x.x.
Please check the official documentation for more details:
Result API https://docs.scanbot.io/android/document-scanner-sdk/detailed-setup-guide/result-api/
ImageRef API https://docs.scanbot.io/android/document-scanner-sdk/detailed-setup-guide/image-ref-api/
*/
Expand Down Expand Up @@ -105,9 +105,16 @@ class MainActivity : AppCompatActivity() {

private suspend fun createAndScanDocumentPage(imageUri: Uri): String? {
val imageRef = withContext(Dispatchers.IO) {
val inputStream = contentResolver.openInputStream(imageUri)
?: throw Exception("Cannot open input stream from URI")
ImageRef.fromInputStream(inputStream)
contentResolver.openInputStream(imageUri)?.use { inputStream ->
ImageRef.fromInputStream(inputStream)
}
}
if (imageRef == null) {
withContext(Dispatchers.Main) {
Log.e(Const.LOG_TAG, "Cannot open input stream from URI: $imageUri")
showToast("Error opening selected image!")
}
return null
}

val sdk = ScanbotSDK(this)
Expand Down
8 changes: 3 additions & 5 deletions classic-components-example/barcode-scanner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ android {
versionName = "1.0"
}

kotlin {
jvmToolchain(project.ext.jvmToolchainVersion)
}

buildTypes {
named("debug") {
// set this to `false` to allow debugging and run a "non-release" build

minifyEnabled = false
debuggable = true
}
Expand All @@ -32,6 +28,8 @@ android {
}
}

kotlin.jvmToolchain(project.ext.jvmToolchainVersion)

dependencies {
implementation(project(":common"))
implementation("androidx.appcompat:appcompat:${project.ext.androidxAppcompatVersion}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ class BarcodeScanAndCountViewActivity : AppCompatActivity() {
scanButton = findViewById(R.id.snapButton)
nextButton = findViewById(R.id.nextButton)
snapResult = findViewById(R.id.snapped_message)

val flashButton: Button = findViewById(R.id.flash)
flashButton.setOnClickListener {
flashEnabled = !flashEnabled
scanCountView.viewController.useFlash(flashEnabled)
}
ScanbotSDK(this).createBarcodeScanner().onSuccess { scanner ->

scanner.setConfiguration(scanner.copyCurrentConfiguration().copy().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Matrix
import android.os.Bundle
import android.widget.Button
import android.widget.ImageView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -51,7 +52,11 @@ class BarcodeScannerActivity : AppCompatActivity(), BarcodeScannerFrameHandler.R
cameraView = findViewById(R.id.camera)
resultView = findViewById(R.id.result)
finderOverlay = findViewById(R.id.finder_overlay)

val flashButton: Button = findViewById(R.id.flash)
flashButton.setOnClickListener {
flashEnabled = !flashEnabled
cameraView.useFlash(flashEnabled)
}
cameraView.setCameraOpenCallback {
cameraView.postDelayed({
cameraView.useFlash(flashEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ import android.Manifest
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updateLayoutParams
import io.scanbot.common.Result
import io.scanbot.common.onFailure
import io.scanbot.common.onSuccess
Expand Down Expand Up @@ -48,7 +44,11 @@ class BarcodeScannerViewActivity : AppCompatActivity() {

barcodeScannerView = findViewById(R.id.barcode_scanner_view)
resultView = findViewById(R.id.result)

val flashButton: Button = findViewById(R.id.flash)
flashButton.setOnClickListener {
flashEnabled = !flashEnabled
barcodeScannerView.viewController.useFlash(flashEnabled)
}
ScanbotSDK(this).createBarcodeScanner().onSuccess { scanner ->
scanner.setConfiguration(scanner.copyCurrentConfiguration().copy().apply {
setBarcodeFormats(barcodeFormats = BarcodeTypeRepository.selectedTypes.toList())
Expand Down Expand Up @@ -88,7 +88,11 @@ class BarcodeScannerViewActivity : AppCompatActivity() {
image: ImageRef,
captureInfo: CaptureInfo
) {
TODO("Not yet implemented")
image.toBitmap().onSuccess { bitmap ->
resultView.post {
resultView.setImageBitmap(bitmap)
}
}
}

override fun onSelectionOverlayBarcodeClicked(barcodeItem: BarcodeItem) {
Expand All @@ -107,7 +111,6 @@ class BarcodeScannerViewActivity : AppCompatActivity() {

override fun onResume() {
super.onResume()
barcodeScannerView.viewController.onResume()
if (ContextCompat.checkSelfPermission(
this,
Manifest.permission.CAMERA
Expand All @@ -122,11 +125,6 @@ class BarcodeScannerViewActivity : AppCompatActivity() {
}
}

override fun onPause() {
super.onPause()
barcodeScannerView.viewController.onPause()
}

private fun handleSuccess(result: BarcodeScannerResult) {
result.takeIf { it.barcodes.isNotEmpty() }?.let {
BarcodeResultRepository.barcodeResultBundle = BarcodeResultBundle(result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

/**
Ths example uses new sdk APIs presented in Scanbot SDK v.8.x.x
Please, check the official documentation for more details:
This example uses the SDK APIs introduced in Scanbot SDK v8.x.x.
Please check the official documentation for more details:
Result API https://docs.scanbot.io/android/document-scanner-sdk/detailed-setup-guide/result-api/
ImageRef API https://docs.scanbot.io/android/document-scanner-sdk/detailed-setup-guide/image-ref-api/
*/
Expand Down Expand Up @@ -101,14 +101,25 @@ class MainActivity : AppCompatActivity() {
binding.progressBar.isVisible = true
}

withContext(Dispatchers.Default) {
val inputStream = contentResolver.openInputStream(uri) ?: throw IllegalStateException("Cannot open input stream from URI: $uri")
val imageRef = ImageRef.fromInputStream(inputStream)
val imageRef = withContext(Dispatchers.IO) {
contentResolver.openInputStream(uri)?.use { inputStream ->
ImageRef.fromInputStream(inputStream)
}
}
if (imageRef == null) {
withContext(Dispatchers.Main) {
binding.progressBar.isVisible = false
showToast("Error opening selected image!")
Log.e(Const.LOG_TAG, "Cannot open input stream from URI: $uri")
}
return
}

withContext(Dispatchers.Default) {
val scanner = scanbotSdk.createBarcodeScanner().getOrThrow()
scanner.setConfiguration(scanner.copyCurrentConfiguration().copy().apply {
setBarcodeFormats(barcodeFormats = BarcodeTypeRepository.selectedTypes.toList())
} )
})
val result = scanner.run(imageRef).getOrNull()

BarcodeResultRepository.barcodeResultBundle = result?.let { BarcodeResultBundle(it, imageRef) }
Expand Down
6 changes: 3 additions & 3 deletions classic-components-example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("com.android.application") version "8.3.2" apply false
id("com.android.application") version "8.9.1" apply false
id("com.android.library") version "8.3.2" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}
Expand All @@ -10,12 +10,12 @@ allprojects {
submodulesNamespace = "io.scanbot.example"

compileSdkVersion = 36
minSdkVersion = 21
minSdkVersion = 23
targetSdkVersion = 35

jvmToolchainVersion = 17

scanbotSdkVersion = "8.1.0"
scanbotSdkVersion = "9.0.0.1206-SNAPSHOT"

androidCoreKtxVersion = "1.6.0"
constraintLayoutVersion = "2.0.4"
Expand Down
8 changes: 3 additions & 5 deletions classic-components-example/camera-fragment/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ android {
versionName = "1.0"
}

kotlin {
jvmToolchain(project.ext.jvmToolchainVersion)
}

buildTypes {
named("debug") {
// set this to `false` to allow debugging and run a "non-release" build

minifyEnabled = false
debuggable = true
}
Expand All @@ -40,6 +36,8 @@ android {
}
}

kotlin.jvmToolchain(project.ext.jvmToolchainVersion)

dependencies {
implementation(project(":common"))
implementation("androidx.appcompat:appcompat:${project.ext.androidxAppcompatVersion}")
Expand Down
17 changes: 0 additions & 17 deletions classic-components-example/camera-fragment/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

/**
Ths example uses new sdk APIs presented in Scanbot SDK v.8.x.x
Please, check the official documentation for more details:
This example uses the SDK APIs introduced in Scanbot SDK v8.x.x.
Please check the official documentation for more details:
Result API https://docs.scanbot.io/android/document-scanner-sdk/detailed-setup-guide/result-api/
ImageRef API https://docs.scanbot.io/android/document-scanner-sdk/detailed-setup-guide/image-ref-api/
*/
Expand Down Expand Up @@ -115,12 +115,15 @@ class MainActivity : AppCompatActivity() {
}

val documentImage = withContext(Dispatchers.Default) {
catchWithResult {
// load the selected image:
val inputStream = contentResolver.openInputStream(imageUri)
?: throw IllegalStateException("Cannot open input stream from URI: $imageUri")
val image = ImageRef.fromInputStream(inputStream)
val image = contentResolver.openInputStream(imageUri)?.use { inputStream ->
ImageRef.fromInputStream(inputStream)
}
if (image == null) {
Log.e(Const.LOG_TAG, "Cannot open input stream from URI: $imageUri")
return@withContext null
}

catchWithResult {
// create a new Document object with given image as original image:
val newDocument = scanbotSdk.documentApi.createDocument()
.getOrReturn() // can be handled with .getOrNull() if needed
Expand All @@ -144,6 +147,10 @@ class MainActivity : AppCompatActivity() {

withContext(Dispatchers.Main) {
progressBar.visibility = View.GONE
if (documentImage == null) {
this@MainActivity.showToast("Error opening selected image!")
return@withContext
}
// show Page's document image:
importResultImage.setImageBitmap(documentImage)
importResultImage.visibility = View.VISIBLE
Expand Down
Loading