Android - take picture - pass uri to camera app -
Android - take picture - pass uri to camera app -
i trying follow tutorial invoke photographic camera app , inquire save image @ uri passed in intent.
file image = file.createtempfile("testimage", ".jpg", getexternalfilesdir(environment.directory_pictures)); uri uri = uri.fromfile(image); intent = new intent(); i.setaction(mediastore.action_image_capture); i.putextra(mediastore.extra_output, uri); if (i.resolveactivity(getpackagemanager()) != null) { startactivityforresult(i, 1); }
the path of image :
/storage/emulated/0/android/data/com.android.test1.app/files/pictures/testimage-516714791.jpg
i want inquire how did photographic camera app have permission write path ? testing on android 4.4, path externalfilesdir
not publicly writable.
the reference says:
there no security enforced these files. example, application holding write_external_storage can write these files.
starting in kitkat, no permissions required read or write returned path; it's accessible calling app. applies paths generated bundle name of calling application. access paths belonging other packages, write_external_storage and/or read_external_storage required.
so, scheme photographic camera app, or other app granted write_external_storage
permission can write /storage/emulated/0/android/data/com.android.test1.app/files/pictures/
.
android android-camera uri android-camera-intent
Comments
Post a Comment