onPictureSaved not called on Android


#1

Running SDK 31

I am using the Camera API: https://docs.expo.io/versions/v30.0.0/sdk/camera

I call takePictureAsync but onPictureSaved function I have is not being called on Android.

It is being called on iOS.

if (this.camera) {
await this.camera.takePictureAsync({onPictureSaved: this.onPictureSaved});
this.camera.pausePreview();
}


#2

Snack: https://snack.expo.io/@rshellborn/camera-api-issue-android


#3

Hey @rshellborn,

Thanks for providing us with a Snack. Going to see if we can reproduce this on our end. Could you also let me know what device you’ve reproduced this behavior on?

Cheers,

Adam


#4

Samsung Galaxy S6

FYI I ask for camera permissions before using the component in the snack

async _checkCameraRollPerms() {
        Keyboard.dismiss();
        const {status} = await Permissions.getAsync(Permissions.CAMERA_ROLL, Permissions.CAMERA);

        if(status === 'granted') {
            this._displayPhotoOptions();
        } else {
            const {status} = await Permissions.askAsync(Permissions.CAMERA_ROLL, Permissions.CAMERA);

            if (status === 'granted') {
                this._displayPhotoOptions();
            } else {
                Alert.alert(
                    I18n.t('cameraDeniedTitle'),
                    I18n.t('cameraDeniedDescription'),
                    [
                        {text: 'OK', onPress: () => {}}
                    ],
                    { cancelable: false }
                )
            }
        }
    }