googlesamples / googlesamples/mlkit

[Bug report] GmsDocumentScannerOptions.CAPTURE_MODE_MANUAL does not work for the document scanner

Open
#846 13 comments 3 reactions 1 assignee Assigned to @mebjas View on GitHub
Dominant language
Kotlin
Stars
4.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

I want when I launch the document scanner to go directly into the Manual Mode and if possible hide the Auto Capture button. I tried setting the mode to CAPTURE_MODE_MANUAL, but it is not working.

Below is my code to reproduce the bug

```
fun startScanner(activity: Activity?, pageLimit: Int = 10) {
if (activity == null) {
Timber.i("Unable to launch scanner: activity is null.")
return
}

val options = buildScannerOptions(pageLimit)
val scanner = GmsDocumentScanning.getClient(options)

scanner.getStartScanIntent(activity)
.addOnSuccessListener { intent ->
val request = IntentSenderRequest.Builder(intent).build()
launcher.launch(request)
}
.addOnFailureListener { exception ->
showToast(activity, exception.localizedMessage)
}
}

private fun buildScannerOptions(pageLimit: Int): GmsDocumentScannerOptions {
return GmsDocumentScannerOptions.Builder()
.setGalleryImportAllowed(true)
.setResultFormats(
GmsDocumentScannerOptions.RESULT_FORMAT_PDF,
GmsDocumentScannerOptions.RESULT_FORMAT_JPEG
)
.setPageLimit(pageLimit)
.setScannerMode(GmsDocumentScannerOptions.CAPTURE_MODE_MANUAL)
.build()
}
```

**Expected behavior**
The Auto Capture button should be hidden or at least not the default mode but the manual mode.

**SDK Info:**
- 'com.google.android.gms:play-services-mlkit-document-scanner:16.0.0-beta1'

**Smartphone:**
- Device: Samsung Galaxy A34, Model: SM-A346E
- Device OS: Android 13

**Development Environment:**
Android Studio Jellyfish

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.