openfoodfacts / openfoodfacts-androidapp

(Legacy) Native version of Open Food Facts on Android - Coders & Decoders welcome 🤳🥫
https://android.openfoodfacts.org
Apache License 2.0
767 stars 446 forks source link

Barcode Scanner as library or module #4854

Closed ReIaxo closed 1 year ago

ReIaxo commented 1 year ago

What

Is it possible to separate the Barcode scanner to a library or module so that other apps can easy implement OFF product scanning?

Why/User story

I think many projects which use the OFF database want a Barcode scanning feature.

For example: Projects which have Issues related to Barcode scanner: Privacy friendly foodtracker # 89

VaiTon commented 1 year ago

For scanning barcodes we use MLKit and ZXing. What do you mean with a "Barcode scanner library"?

ReIaxo commented 1 year ago

I mean a ready to use OFF scanner fragment/view, that one can call and getting product result back after scanning. Or is it that easy that something like that is not needed? Sorry, I haven't looked at the implementation here.

DanieliusAsm commented 1 year ago

CameraX since 1.2.0-beta01 has a new library called camera-mlkit-vision:

New library camera-mlkit-vision. Easily integrate CameraX with many MLKit features, including barcode scanning, face detection, text detection, etc. Please find the sample code here.

I havent tried it myself but the implementation looks to be even easier than what I use.

VaiTon commented 1 year ago

I don't think we have enough resources here to do that, so I'm closing this for now as not planned. Feel free to create a PR though if you want!