capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
437 stars 167 forks source link

[ML-Kit] [Android] Bugfix: don't crash when no camera #249

Closed JanMisker closed 1 year ago

JanMisker commented 1 year ago

Certain devices might not have a camera, or not a camera facing the right direction. This would cause a big crash, because the resulting IllegalArgumentException wasn't caught.

This (quick) fix catches that exception, so at least the app won't crash. In a future it would be nice to have a some kind of getCameraInfo call that return the available options (camera direction, zoom, etc).

thegnuu commented 1 year ago

Looks good, and getCameraInfo is a great idea. There is as well an issue regarding this #226. Do you have an idea if it is possible to fetch the required information without camera permission? Should be possible IMHO, but I am not sure about it.