Difference between FILE_URI and NATIVE_URI in cordova plugin camera

Riyad Khalifeh picture Riyad Khalifeh · Jun 18, 2015 · Viewed 8k times · Source

What is the different between FILE_URI and NATIVE_URI in cordova plugin camera?

Answer

Kim T picture Kim T · Aug 5, 2015

There are three options, and from what I understand they are different per platform:

Camera.DestinationType.FILE_URI
    'file://' ios
    'content://' android

Camera.DestinationType.NATIVE_URI
    'assets-library://' ios
    'content://' android

Camera.DestinationType.DATA_URL
    'data:image/jpg;base64,'

If you want to convert them to other urls you can use the file plugin: https://github.com/apache/cordova-plugin-file

navigator.camera.getPicture(function (path) {
    window.alert('getPicture.success: ' + JSON.stringify(path));
    window.resolveLocalFileSystemURI(path, function (fileEntry) {
        window.alert("success: " + JSON.stringify(fileEntry));
    }, function (e) {
        window.alert("error: " + JSON.stringify(e));
    });
}, function (e) {
    window.alert('getPicture.error: ' + JSON.stringify(e));
}, $scope.options);

Here is the documentation for the options: https://github.com/apache/cordova-plugin-camera/blob/master/www/CameraConstants.js

And also the link to the source code for this function: https://github.com/apache/cordova-plugin-file/blob/master/www/resolveLocalFileSystemURI.js