Android barcode problem

Hi, my name is Mauricio, i’m from Brazil.
I have a xojo Pro License using the last version.
I’m having a problem with Android Barcode component.
I’m developing an android app to scan a qr-code.
I put the control in a screen. i call for example “bc”
I drag an mobilebutton into screen.
In pressed event:
bc.startscan
I’m building the app not by playstore, just compile an Apk with a Keystore and it works well.
When i download that .apk by a link, the device installs the apk, it’s ok, the scan works fine !
But, it just happens only if i leave device in factory settings and install the .apk for the first time.
The app reads the qr-code, open the camera, it seems all right.
The problem is when i try update this .apk or even uninstall the .apk and try to update or reinstall the .apk
When i do this the “scan” does not work anymore !!!
I receive the event ( Failed ) on my “bc” barcode scanner.
I’m using last android version with last xojo version, i’ve tried also with an older version and the problem is the same.
I also tried compile with Mac-Os and Windows but the problem is the same.
My device: xiaomi note 11s - Miui 14 - android 13, i’ve tried also with xiaomi 10 - Miui 14 - android 12
the .apk works fine first time , after an update or reinstall i face the problem again.
Am i doing something wrong ?
Any tips ?
Thanks in advance.
Mauricio

Same is happening to me
Redmi Note 10S
MIUI 12.5.16
Xojo 2023r4

I also tested with Motorola
Moto G7 Power with Android 10
The same happened with the code:
Scanner.StartScan
goes to
Scanner.ScanFailed

With Samsung S23 Ultra OneUI 6.1 Android 14 works fine

I beleive that XOJO is using ML Kit to recognize QR codes, and in Android 14 nothing have to be installed in order to work fine.
@Paul_Lefebvre do you have any advice in order to let use ML Kit in older versions of Android if this is the way Xojo access to camera without any permision.
If not is there any way to ask permision to access the build in camera from XOJO ?

We are using com.google.android.gms:play-services-code-scanner, which is compatible with Android SDK 21 or higher.

According to their docs, if the scanner module is not installed for some other reason, Google Play Services will install it the first time it is used. This may not be immediate, though.

The ImagePicker control lets you take photos using the camera.

Both:

  • Motorola EDGE 30 Fusion with Android 13
  • Samsung A 22 5G with Android 13 OneUI 5.1
  • Galaxi A 21S Android 12 OneUI 4.1
    works fine and using ML Kit

The issue might be related to how the app handles updates or reinstalls. Checking for any update-related bugs could help.

@Mauricio_Lima1 had fixed this problem.
He gave me the solution in private message and works perfect for me.
I share it in order to let anyone with the same problem solve it.

Instructions:
Configuration → APPS → Admin Apps
Find Apps → type Google Play Services
At the end there is a button ( Clean Data )
You wil see:
Manage Space
Clean Cache
Go to Clean Space

1 Like