[英]Android camera take picture permission denial
Trying to take a picture and it gives me a mistake in the permissions. 尝试拍照,这给我一个错误的权限。 Because it can not save.
因为无法保存。
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.write_external_storage"/>
private PictureCallback mPicture = new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
Log.d(TAGL,"W onPictureTaken");
File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE);
if (pictureFile == null){
Log.d(TAGL, "Error creating media file, check storage permissions: ");
//It shows the error I do not have Permission.
return;
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
} catch (FileNotFoundException e) {
Log.d(TAGL, "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d(TAGL, "Error accessing file: " + e.getMessage());
}
}
};
Why do I get out refusal of access? 为什么我会拒绝访问? Tests on Android devices 4.04 and 4,4,2 and the same error;
在Android设备4.04和4,4,2上进行测试,并且出现相同的错误; /
/
Permission names are case sensitive. 权限名称区分大小写。 Use:
采用:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.