onCameraReady not called for Android

Hi there,

I just upgraded from sdk 23 to 27.
The app uses BarCodeScanner, as i’m testing on expo on iPhone 6+ (11.3.1) and Huawei P20 (Android 8.1.0), the iOS works just fine as before but the android doesnt seem to work (cant scan anything).

I put in some console logs in onCameraReady and find only the iOS calls it, and the android one never does. Im guessing thats why it cant scan anything.

                <View style={styles.camera}>
                    <BarCodeScanner
                        type={this.props.cameraFace}
                        onBarCodeRead={this._handleBarCodeRead}
                        autoFocus={Camera.Constants.AutoFocus.on}
                        focusDepth={1}
                        barCodeTypes={[Camera.Constants.BarCodeType.qr]}
                        onCameraReady={this._cameraReady}
                        style={{
                            height: Dimensions.get('window').height,
                            width: Dimensions.get('window').width,
                        }}
                    />
                </View>

Any ideas?

Edit:
Tested on Samsung Galaxy S9+ (8.0.0), no problems. hmmmm
Tested on another Huaweu phone, 8.0.0 also, no problems.

Must be an 8.1.0 issue? Need to test on non Huawei 8.1.0 phones

Hi-

Here is a Snack of your code so others can easily try.

I think there are some issues with Huawei phones and the barcode scanner right now.
Here is a related Github issue:
https://github.com/expo/expo/issues/1782

Hello, we need to update the docs, we planned to have BarCodeScanner based on Camera (and did for some time) but it resulted in some issues. So if you want to make use of Camera methods and props, just use Camera component

I don’t know if it matters, but when I was working with Camera on android, camera had to be the top component, no View component surrounding it. I’m kind of new, but thought it might help.

I just want to use onBarCodeRead, im sure that is from BarCodeScanner?

Yes, if you just need onBarCodeRead you can just use BarCodeScanner but Camera has this prop as well.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.