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

Turning on and off the flash is not working on Android 11 #646

Open
TheKamranUllah opened this issue Aug 17, 2021 · 2 comments
Open

Turning on and off the flash is not working on Android 11 #646

TheKamranUllah opened this issue Aug 17, 2021 · 2 comments

Comments

@TheKamranUllah
Copy link

Description of the problem:

if (isFlashOn) {
mCodeScanner!!.isFlashEnabled = false
isFlashOn = false
Toast.makeText(getActivity(), "False", Toast.LENGTH_LONG).show();
} else {
mCodeScanner!!.isFlashEnabled = true
isFlashOn = true
Toast.makeText(getActivity(), "True", Toast.LENGTH_LONG).show();
}
The above code makes no sense for turning flash light on/off

Which library version are you using? E.g. 3.2.0.
Library version: 3.2.1'

Which phone/tablet are you using, and which Android version does it run? (e.g. Samsung Galaxy S5,
Android 5.0)

I am using Redmi 9 with Android version 11

Does the same happen on other devices or an emulator?
Works fine on Android 10 and Android 6 I checked on these two.

Can you reproduce the issue in the sample project included with the library? If not, can you
provide your own sample project or sample code that produces this error?

Provided above in the problem description

In the case of an error do you have a stack trace or adb logs?

@rkistner
Copy link
Member

Using the sample project, flash works for me on Android 11.

The above code does not show how it is trying to turn the flash on or off.

See this code for a working sample:

https://github.com/journeyapps/zxing-android-embedded/blob/master/sample/src/main/java/example/zxing/CustomScannerActivity.java

@manumathew17
Copy link

I am also faced the same issue i copied all code from this repository and created the new library with small change where flash light button is integrated in Barcodeview layout
you can use from here repo

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