BinaryEye
BinaryEye copied to clipboard
Handle QR code scan intents
At first, thanks for this great app! It looks a lot nicer than the original Barcode Scanner app from zxing while being at least as powerful and fast!
One downside I noticed while using BinaryEye is that most of the apps calling a QR Code reader application use the native Barcode Scanner intent (com.google.zxing.client.android.SCAN
), which is not handled by BinaryEye. I would find it very useful to be able to select BinaryEye as a target application for scanning QR Codes. Sadly, there does not seem to exist an package-independant Intent for querying any installed QR code scanner apps.
A quite simple workaround would be to add a new intent filter with the same name as Barcode scanner and handle it inside CaptureActivity.java
.
What do you think of such a functionality? I would be willing to look into it, but I wanted to discuss it here first.
Well, it would be fairly easy to add an Intent Filter for com.google.zxing.client.android.SCAN
. I just wasn't aware that apps do use that intent instead of including ZXing. So yes, I should really add that intent filter 👍
Maybe the app should also respond to android.media.action.IMAGE_CAPTURE
? BinaryEye would show up for every take-picture-intent what's probably more generic.
Implemented in https://github.com/markusfisch/BinaryEye/commit/d2c8ef719b040d7e249ecc8b767cd90734d06a5a
Wow, that was fast! Thank you very much for your quick reaction!
However, when calling BinaryEye via the Intent, the calling app is likely to expect some sort of return value (see https://github.com/zxing/zxing/blob/master/android/src/com/google/zxing/client/android/Intents.java#L121 for a starting point). Also, it could set some extra intent options (see the same file linked above). So, BinaryEye should handle calls via Intents differently, check for Intent options and return the recognized data to the Activity that called it, similar to what is implemented here.
Maybe the app should also respond to android.media.action.IMAGE_CAPTURE? BinaryEye would show up for every take-picture-intent what's probably more generic.
Also, I'm not sure if this is really necessary. If an app wants to take a picture is is not likely that it wants to read a QR code at this point...
You are totally right, of course 🙈
IMAGE_CAPTURE
doesn't make sense and the app needs to return what's read for SCAN
.
Now at least the scan result is returned: https://github.com/markusfisch/BinaryEye/commit/7b67778a290899fc1675c8d69a4068241e6d0b33
I'll keep this issue open to remind me of evaluating the intent's extra options.
AFAIK, it did not open for the QR code scan intend of Firefox for Android: (mostly tested with Firefox for Android) See https://support.mozilla.org/kb/scan-qr-codes-firefox-android
IMHO, you should really implement this, as the original ZXing app is not so nice and buggy.
AFAIK, it did not open for the QR code scan intend of Firefox for Android: (mostly tested with Firefox for Android)
and (from #10):
I'm using syncthing from fdroid. When trying to add another device via QR code, the app asks if barcode reader should be installed (it even specifically asks for/suggests zxing) even though BinaryEye (also from fdroid) is installed. This does not happen if zxing is installed.
This happens because most likely Firefox and Syncthing (and most other apps) are using the IntentIntegrator
from the ZXing library. Inside this Java file, all apps "known to respond properly to the intent" are hardcoded.
So, in my opinion the way to go is:
- properly evaluate the intent's extra options within BinaryEye (which appears to be nothing but
SCAN_FORMATS
andSCAN_CAMERA_ID
) - create a PR for the ZXing library to include BinaryEye as a compatible application
- create PRs for all apps using the
IntentIntegrator.java
class (most likely copies of ZXing's one)
Edit:
- at least syncthing e.g. is adding the ZXing code via Gradle, so only the version number should be bumped whenever a PR adding BinaryEye is accepted.
- Firefox for Android is explicitly restricting QR code intents to the Barcode Scanner App