Closed 2639117470 closed 7 years ago
5.0以上的系统没问题,4.0的系统上,报上述错误; GalleryPickActivity.java的showCameraAction()函数,修改一下: private void showCameraAction() { // 跳转到系统照相机 Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (cameraIntent.resolveActivity(mActivity.getPackageManager()) != null) { // 设置系统相机拍照后的输出路径 // 创建临时文件 cameraTempFile = FileUtils.createTmpFile(mActivity, galleryConfig.getFilePath()); Uri imageUri = FileProvider.getUriForFile(mContext, "com.yancy.gallerypick.fileprovider", cameraTempFile); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
List<ResolveInfo> resInfoList = mContext.getPackageManager().queryIntentActivities(cameraIntent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { String packageName = resolveInfo.activityInfo.packageName; mContext.grantUriPermission(packageName, imageUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } startActivityForResult(cameraIntent, REQUEST_CAMERA); } else { Toast.makeText(mContext, R.string.gallery_msg_no_camera, Toast.LENGTH_SHORT).show(); galleryConfig.getIHandlerCallBack().onError(); } }
感谢反馈,,, 已经修改此bug 稍作整理 会发布下个版本
5.0以上的系统没问题,4.0的系统上,报上述错误; GalleryPickActivity.java的showCameraAction()函数,修改一下: private void showCameraAction() { // 跳转到系统照相机 Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (cameraIntent.resolveActivity(mActivity.getPackageManager()) != null) { // 设置系统相机拍照后的输出路径 // 创建临时文件 cameraTempFile = FileUtils.createTmpFile(mActivity, galleryConfig.getFilePath()); Uri imageUri = FileProvider.getUriForFile(mContext, "com.yancy.gallerypick.fileprovider", cameraTempFile); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);