image - phonegap resolveLocalFileSystemURL does not work for content uri on android -


i want receive share image android image gallery using nexus 4 phone on android version 5.1.1. using phonegap 4.2 , phonegap webintent plugin github link , phonegap file plugin doc link.

text , links works fine when tried share image android gallery, uri this:

content://com.google.android.apps.photos.contentprovider/0/1/content%3a%2f%2fmedia%2fexternal%2fimages%2fmedia%2f63131/actual

instead of file:///....

i tried use window.resolvelocalfilesystemurl function resolve url returns successful fileentry object. however, when try use read file, error code 1000 (see below code , output).

interestingly, if display url via img tag, able see image fine.

<img src="" id="test_intent_image"> $('#test_intent_image').attr("src",uri); 

this suggests problem might window.resolvelocalfilesystemurl function can't handle content://... type uris properly?

===== reference info ======

here code i'm using (note: tried other file functions such copyto() app folder gives same error):

    document.addeventlistener("deviceready", shared, false);     document.addeventlistener("resume", shared, false);    function shared () {  window.plugins.webintent.getextra(window.plugins.webintent.extra_stream, function(data) { // data value of extra_text     if (! data) {         return;     }      window.resolvelocalfilesystemurl(         data,          function (entry) {             console.log('file entry: ' + json.stringify(entry, null,3) );              function win(file) {                 var reader = new filereader();                 reader.onloadend = function (evt) {                     console.log("file read success");                     console.log(evt.target.result);                 };                  reader.readastext(file);             };              function fail (error) {                 console.log("file read error: " + error.code);             };              entry.file(win, fail);          },          function (error) {             console.log('file error: ' + error);         });  }, function() {     // there no supplied.     // debug_log("web intent getextra: no extra");     } ); 

}

here console output of code when tried share image image gallery:

handle share stream :"content://com.google.android.apps.photos.contentprovider/0/1/content%3a%2f%2fmedia%2fexternal%2fimages%2fmedia%2f63087/actual" file entry: {    "isfile": true,    "isdirectory": false,    "name": "actual",    "fullpath": "/com.google.android.apps.photos.contentprovider/0/1/content%3a//media/external/images/media/63087/actual",    "filesystem": "<filesystem: content>",    "nativeurl": "content://com.google.android.apps.photos.contentprovider/0/1/content%3a%2f%2fmedia%2fexternal%2fimages%2fmedia%2f63087/actual" } file read error: 1000 

here intent filter in androidmanifest.xml file. note: sharing works fine, not able resolve url not issue.

<intent-filter> <action android:name="android.intent.action.send" />             <category android:name="android.intent.category.default" />             <data android:mimetype="*/*" />         </intent-filter> 

i have been having exact same issue, no direct solution using standard file plugin.

i tried plugin https://github.com/hiddentao/cordova-plugin-filepath android content uri's.

you use function instead, , appears working.

window.filepath.resolvenativepath('content://...', successcallback, errorcallback);


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -