Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
3.5.0
-
None
-
Samsung Galaxy S5, Android 4.4.4.
Description
It appears that the issue is that the uri returned by that.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values) is not properly resolved by OutputStream os = that.cordova.getActivity().getContentResolver().openOutputStream(uri).
What worked for me was instead of calling openOutputStream, do the following:
String dfname = getRealPathFromURI(uri);
File df = new File(dfname);
File dfolder = df.getParentFile();
if(!dfolder.exists()) dfolder.mkdirs();
if(!df.exists()) df.createNewFile();
FileOutputStream os = new FileOutputStream(df);
private String getRealPathFromURI(Uri contentURI) {
Cursor cursor = this.cordova.getActivity().getContentResolver().query(contentURI, null, null, null, null);
if (cursor == null)
else
{ cursor.moveToFirst(); int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); return cursor.getString(idx); }}
Attachments
Attachments
Issue Links
- relates to
-
CB-7740 navigator.device.capture.captureImage() returns error each time
- Closed