0
私は取得しています:android.os.FileUriExposedException。カメラがアンドロイドで動作しません7.0
When targeting Android N, file:// URIs are not allowed anymore. I know We should use content:// URIs instead. However, my app needs file for both image and video. Any ideas?
mMediaUri = Uri.fromFile(new File(AppHelper.getDirectoryPath(),AppHelper.getFileName() + ".jpeg"));
Intent iCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
iCamera.putExtra(MediaStore.EXTRA_OUTPUT, mMediaUri);
startActivityForResult(iCamera, Constants.INTENT_CALL.CAPTURE_IMAGE);
とonActivityResult
case Constants.INTENT_CALL.CAPTURE_IMAGE:
String filePath=SiliCompressor.with(getActivity()).compress(mMediaUri.toString(), true);
Please add sample code...if Available.
に私の質問だけで設定分ターゲットSDKのバージョンに関連した答えを得た後にあなたを持っていますrでカメラを使用するための許可を求めましたアンタイム? – magicleon
https://stackoverflow.com/questions/38200282/android-os-fileuriexposed-file-storage-emulated-0-test-txt-exposed https://github.com/commonsguy/cw-omnibus/tree/master/カメラ/ FileProvider https://github.com/commonsguy/cw-omnibus/tree/master/Media/VideoRecordIntent – CommonsWare
はい実行時のアクセス許可を追加しました.... Android Nのみを対象とした場合のみ、android.os.FileUriExposedExceptionが発生します。 。 –