0

i try from a cordova plugin to return an image taken from the camera. The image is saved and exists, when I return the array of uri with the uri of the image, I retrieve nothing.

If i take from gallery it works, the code in the "onActivityResult" function when i take from gallery

 String dataString = intent.getDataString();
    if (dataString != null) {
        results = new Uri[]{Uri.parse(dataString)};
    }
    mFilePathCallback.onReceiveValue(results);
    mFilePathCallback = null;

Datastring contain a content:// path format.

When i try this code, in the case of photo taken from camera

results = new Uri[]{Uri.fromFile(photoFile)};
mFilePathCallback.onReceiveValue(results);

I have an empty object. I have The same problem if i load the image from Android FileExplorer, the uri returned in this and camera case is in file:// format.

I try to find the solution on stackoverflow.com or Google but nothing. I try to convert the format file to content with File provider. getUriForFile without success.

Someone can help me? Sorry for bad english, if needs some others informations ask me.

Thanks

Valerio Cicero
  • 347
  • 4
  • 13

1 Answers1

0

Ok, I solved myself, the problems came from the permision to read/write.

I add the permissions in plugins.xml to set permissions on the Manifest and now works.

The code was correct!

Valerio Cicero
  • 347
  • 4
  • 13