Android Question CameraEx and new SDK 34

pliroforikos

Active Member
Licensed User
Hello,
I'm using a edited copy of bellow example in order to scan QRcodes with my app.
https://www.b4x.com/android/forum/threads/b4x-b4xpages-barcode-reader.120417/page-2#posts

Today as i was reading google console i saw an error about camera.
"As of Android 14, developers must specify service types when services are detected in the foreground in their app's manifest. A version of your app that is currently in production has an error because it tries to launch a service in the foreground when no service type is declared in the foreground. Make sure that the service types for the services being started in the foreground are defined in your application's manifest."

As i can see is the new politics in ver 34, and as explained here i put
B4X:
AddPermission(android.permission.FOREGROUND_SERVICE_CAMERA)

in manifest.

I wonder if you guys has same problem and if everything is allright now or i need something else to do.
Thanks for any help
 

drgottjr

Expert
Licensed User
Longtime User
you need the permission + the foreground service type + google's approval when submitting to play

B4X:
AddPermission(android.permission.FOREGROUND_SERVICE_CAMERA)
SetServiceAttribute(service_name, android:foregroundServiceType, "camera")

plus you should probably add:
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="true" />

plus be ready in case google complains about leaving the camera on all the time, constantly focussing and searching for qr codes
 
Last edited:
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
google says your app has a foreground service. how can you not know its name?
 
Upvote 0
Top