Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bensek opened this issue Jul 9, 2024 · 5 comments
Assignees

Comments

@bensek
Copy link

bensek commented Jul 9, 2024

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

@ai-plays ai-plays self-assigned this Jul 12, 2024
@ai-plays
Copy link
Collaborator

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 ai-plays assigned mebjas and unassigned ai-plays Jul 12, 2024
@ai-plays
Copy link
Collaborator

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

@bensek
Copy link
Author

bensek commented Jul 29, 2024

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

@mebjas
Copy link
Collaborator

mebjas commented Jul 31, 2024

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.

@bensek
Copy link
Author

bensek commented Aug 12, 2024

This is the issue for the request @mebjas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants