rn-qr-generator icon indicating copy to clipboard operation
rn-qr-generator copied to clipboard

Detect not working on Android [QR on slip]

Open kittipat3699 opened this issue 2 years ago • 1 comments

Hello!

I am trying to use qrcode detect. It works fine on ios, but I get nothing on android, like this.

{"type": "", "values": []}

Could you help me? Here's the code:

const openImageFromGallery = async () => {
    try {
      setIsCloseCamera(true)

      const image = await ImagePicker.openPicker({
        width: width,
        height: height,
        mediaType: 'photo',
      })

      const base64ImgId = await RNFS.readFile(image.path, 'base64')
      const response = await RNQRGenerator.detect({
        uri: image.path,
        base64: base64ImgId,
      })

      if (!_.isEmpty(response.values)) {
        setCode([{ displayValue: response.values[0] }])
      } else {
        setIsCloseCamera(false)
        setIsShowPopupQrInvalid(!isShowPopupQrInvalid)
      }
    } catch (error) {
      console.error('🚀 ~ openImageFromGallery ~ error', error)
      return
    }
  }

this QR code I scan

Screen Shot 2565-10-11 at 17 04 35

kittipat3699 avatar Oct 11 '22 10:10 kittipat3699

Hi @kittipat3699. What is device model and OS version?

gevgasparyan avatar Oct 22 '22 12:10 gevgasparyan

Same. It works fine on iOS. But does not work on android (for these kinds of photographed images only). I am using a Samsung A80 device with Android 11 @gevgasparyan

Madubhashana avatar Nov 07 '22 13:11 Madubhashana

bump

janith-rhino avatar Nov 08 '22 08:11 janith-rhino

Is there any other library that can replace

xiaobc1234 avatar Nov 25 '22 07:11 xiaobc1234

The barcode in the photo cannot be recognized

xiaobc1234 avatar Nov 25 '22 07:11 xiaobc1234

Hi @kittipat3699 This module uses zxing lib on android.

If you try to decode the image with zxing online decoder it will also be empty. Seems the issue is with decoder.

Will let you know when I find another solution for that.

Thanks

gevgasparyan avatar Dec 17 '22 17:12 gevgasparyan