Home:ALL Converter>Use Camera on Android 8 without WRITE_EXTERNAL_STORAGE permission

Use Camera on Android 8 without WRITE_EXTERNAL_STORAGE permission

Ask Time:2020-01-07T01:11:26         Author:O.W.Grant

Json Formatter

I am trying to make my app capture an image and send it over to the server, without storing in the filesystem.

If I do it like this:

intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, SOME_REQUEST_CODE);

In onActivityResult I can extract the image via

Bitmap photo = (Bitmap) data.getExtras().get("data");

but this gives me only a thumbnail.

From the documentation it seems that (one of the?) ways to get a full HD image is by instructing the camera app to store the image at some external location, by adding

intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);

However this obviously requires WRITE_EXTERNAL_STORAGE

Considering I don't need the image to be stored in the filesystem, as I am sending it via network anyway, I believe asking for extra storage permission is against "ask only what you need" principle. So is there a possibility to somehow get a full hd image in memory and avoid asking the user for storage permission? Perhaps there exists some special FileProvider path type for such cases?

I have found this answer: Capture image without permission with Android 6.0 but it doesn't use FileProvider (which I have to use on Android 8) and doesn't seem to be applicable to my case.

Thanks.

Author:O.W.Grant,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/59616252/use-camera-on-android-8-without-write-external-storage-permission
Skylark :

System camera app or third party camera apps cannot access your app's internal storage, neither can your app access other camera app's internal storage. Hence External Storage seems to be the only way to communicate data between your app and Camera app.",
2020-01-06T17:51:06
yy