pwlin / cordova-plugin-file-opener2

A File Opener Plugin for Cordova
MIT License
314 stars 587 forks source link

Absolutely nothing happens when trying to open local file! #192

Closed helenburns closed 5 years ago

helenburns commented 6 years ago

I am trying to open a local file, for which I have the correct path for, in the default app for that mime type. A PDF in this example.

FileOpener2 seemed like the only solution I bumped into, and seemed simple to implement, but absolutely nothing happens when I try to open the file... no errors, no successes, nothing! so I don't know where to start!

I know the path is right because this works:

window.open(path_and_file, '_blank', 'location=no,closebuttoncaption=Close,enableViewportScale=yes');

...but I need to be able to open it in an app that will allow the display of bookmarks and can have several files open at once, so the solution above is not really good enough.

So far I have added the plugin to my config.xml in the same way as I do all my other, correctly functioning plugins:

And have added the following code in place of the window.open code above:

cordova.plugins.fileOpener2.open(
    path_and_file,
    'application/pdf', 
    { 
        error : function(e) { 
            console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
        },
        success : function () {
            console.log('file opened successfully');                
        }
    }
);

...but literally nothing happens! No errors in the console, no file opening, no nothing! I'd move onto the next solution but I can't find another plugin out there that does the same!

The path_and_file variable is in local format, beginning file:///var/mobile/Containers/Data/Application/...

Any help appreciated!

darylldawn commented 6 years ago

Same problem right now.

Novan123 commented 6 years ago

Sam problem with Method "showOpenWithDialog". It seems, that if there should be shown a decision menu, it is not visible. The open-method works also not every time. Only if exactly one app for the mimetype is registered. As soon there should be shown a decision menu, nothing happens (?!?)

darylldawn commented 6 years ago

@Novan123 try taking a look at issue #145 and see if it is related.

shnist commented 5 years ago

hi @helenburns, thanks for raising this issue. Were you able to resolve it?

shnist commented 5 years ago

I believe this issue is related to https://github.com/pwlin/cordova-plugin-file-opener2/issues/67. Going to close this one as a duplicate.