从手机设置中的授权摄像头权限返回时,Android应用程序冻结

我使用的是react-native-permissions,当应用最初加载时,它会请求用户摄像头权限,以防万一用户拒绝它,在提示需要说明的警报发出后,应用会将其导航到应用设置相机。

在用户打开相机权限并返回到android应用后,什么也没有发生,并且该应用冻结了。 在iOS上,应用返回流程。

    requestCameraPermission = async () => {
    try {
        const response = await Permissions.request('camera');
        if (response === 'denied' || response === 'blocked') {
            alert("...",Please enable phone's camera.",'',() => OpenAppSettings.open());
            return false
        } else {
            return true
        }
    } catch (e) {
        alert(e.message)
    }
};

在我的App.js componentDidmount中,我将此函数称为:

  requestCameraPermission = async () => {
    const {loadingFlow} = this.props.rootStore.flowStore;

    const permission = await this.props.rootStore.permissionStore.checkCameraPermission();
    if (permission) {

        loadingFlow((route) => {
           //do stuff here and then navigates. (this part works on iOS but not on android)  
        });
    }

};
ch446909360 回答:从手机设置中的授权摄像头权限返回时,Android应用程序冻结

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3168842.html

大家都在问