This is still pinned on r/SimpleMobileTools:
Since 2015 it was possible with Mobile Visions API.
Now it’s included in ML Kit
I think you can use some of microG’s APIs without connecting it to google.
It’s just not implemented yet: https://github.com/microg/GmsCore/issues/2018
Best practices would not require camera permissions to scan qr codes.
Scan barcodes
Android includes support for the Google Code Scanner API, powered by Google Play services, which allows you to decode barcodes without declaring any camera permissions. This API helps preserve user privacy and makes it less likely that you need to create a custom UI for your barcode-scanning use case.
The API scans the barcode and only returns the scan results to your app. Images are processed on-device, and Google doesn’t store any data or scan results.
https://developer.android.com/privacy-and-security/minimize-permission-requests
https://en.wikipedia.org/wiki/The_Work_Number