Troubleshoot Barcode scanner not working


Barcode scanner not working

After user allow permission for camera it returns a blackscreen. Had been downloaded from ai2.appinventor.mit.edu -> apk

If using AI Companion -> "Knox ENrollment Service" - Sorry android camera encountered a problem. You may need to restart the device. (i've already tried restarting)

This sounds like a security issue on your testing device ?

Uhm Like what??

This...

Perhaps provide an example aia project that replicates this behaviour

scany.aia (361.4 KB)
Thank you.

How about deleting the AskForPermission block?

Tested on companion with real device, Google Pixel 4a (Android 13)

I didn't touch your blocks, but had to:

Untick the useExternalScanner checkbox in Designer (no other scanner app installed on my device)
Click the Scan button
Scanned a barcode
Set showUrl visible to true (in order to see the output)
Barcode number returned

No error messages, nothing about Knox Enrolment Service

3 Likes

Solved by TimAI2.

Note, if the camera permission is required the AI2 Bar Code Scanner component should already be requesting it. If using an external scanner, you may have to request camera permission - if so, put it in Screen Initialise.

It's a company phone management system by Samsung:

Camera permission is already allowed

Try This
scany (1).aia (361.9 KB)
Tested On Android 8.1 Samsung Device and works (Companion and apk)

Thanks it works

1 Like

Nice device but my device is Android 10 ig
Thanks anyway

You have quoted from my note out of context. Carry on doing that if you don't want people to help you.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.