我想在我的Android应用中拍照,然后将其保存到相机胶卷中。我正在使用CameraRoll
和RNCamera
,但是在相机胶卷中看不到图像。
函数是:
...
import { RNCamera } from "react-native-camera";
import { CameraRoll } from "react-native";
...
async _takePicture() {
const data = await this.camera.takePictureAsync({
quality: 1.0,
base64: true,
orientation: "portrait",
fixOrientation: true
});
CameraRoll.saveToCameraRoll(data.uri, "photo");
}
...
编辑: 我通过添加
解决了const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
{
title: 'My App Storage Permission',
message: 'My App needs access to your storage ' +
'so you can save your photos',
},
);
CameraRoll.saveToCameraRoll(data.uri, "photo");
之后的