mlkit icon indicating copy to clipboard operation
mlkit copied to clipboard

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

Open bensek opened this issue 1 year ago • 13 comments

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

bensek avatar Jul 09 '24 11:07 bensek

CAPTURE_MODE_MANUAL is not a valid input for setScannerMode.

For scanner mode, valid input are documented here: GmsDocumentScannerOptions.SCANNER_MODE_FULL, GmsDocumentScannerOptions.SCANNER_MODE_BASE_WITH_FILTER, GmsDocumentScannerOptions.SCANNER_MODE_BASE

ai-plays avatar Jul 12 '24 19:07 ai-plays

For the request of disabling Auto-capture, I will pass it to our team.

ai-plays avatar Jul 12 '24 19:07 ai-plays

Is it also possible to disable the auto cropping when I take a photo in manual mode? We would like to have a use case that does not require document scanning, but can still take pictures and use the gallery and use the MLkIt filters. @mebjas

bensek avatar Jul 29 '24 11:07 bensek

Thanks for the request. Currently there is no client API to configure this. Manual vs Auto only control automatic capture. Please file another FR for this and we'd triage it separately based on priority of other items team is working on.

mebjas avatar Jul 31 '24 03:07 mebjas

This is the issue for the request @mebjas

bensek avatar Aug 12 '24 10:08 bensek

why this library is not an open source?!

Al-Taie avatar Oct 15 '24 06:10 Al-Taie

How can I switch to Manual Scanning mode?

Additionally, I would like to disable the auto-rotation feature. I reviewed the documentation, but I couldn't find an option for this. Could you consider adding this feature in future development?

nazymberdaly avatar Oct 17 '24 22:10 nazymberdaly

Additionally, I would like to disable the auto-rotation feature. I reviewed the documentation, but I couldn't find an option for this. Could you consider adding this feature in future development?

Currently this is not supported as an API. We'll add this to our feature request backlog!

mebjas avatar Oct 21 '24 13:10 mebjas

Additionally, I would like to disable the auto-rotation feature. I reviewed the documentation, but I couldn't find an option for this. Could you consider adding this feature in future development?

Currently this is not supported as an API. We'll add this to our feature request backlog!

What is this auto-rotation feature? For me it's always rotating to the wrong side. Looks like a bug

y-maskin avatar Mar 06 '25 14:03 y-maskin

Any update on this? Is there any way to configure enable/disable of auto-capture? @ai-plays @mebjas

hkofficial avatar May 19 '25 12:05 hkofficial

Any updates ?

abed-supy-io avatar Jul 03 '25 11:07 abed-supy-io

Is there any update on this issue? anyone found any workaround? @mebjas

mihirdaka avatar Jul 09 '25 21:07 mihirdaka