Skip to content
This repository has been archived by the owner on Mar 27, 2020. It is now read-only.

not able to open files in Android #37

Open
simpixelated opened this issue Oct 14, 2015 · 3 comments
Open

not able to open files in Android #37

simpixelated opened this issue Oct 14, 2015 · 3 comments
Labels

Comments

@simpixelated
Copy link

Using version 10.4-1.0.9, I'm not able to open files on Android (5.0.1). It does trigger the intent screen, so I know that part is working. But after I select an app, it can't open the file. For PDFs I get a system message that says "Cannot display PDF (filename.pdf cannot be opened)". For images it opens in the app I chose but just shows a blank space or "Media not found.". Here's my code:

fileTransfer.download(fileModel.get('url'), localFilePath, function (entry) {
        window.cordova.plugins.disusered.open(entry.toURL(), success, error);
    }
}, error);

However when I call window.open with the same entry.toURL(), it does work, so I know the file exists and can be viewed. Here's an example URL: file:///data/data/com.homdna.HomDNA/files/appraisal.jpg. I've tried using fileOpener2 as well, with the same results. So I think it likely is a problem with Android, Cordova, or my own code.

@tipstrade
Copy link

I have the same issue - I'm assuming that it's a permission issue - the file is being downloaded to your app's data directory, which is not readable by other apps due to Android's sandboxing.

@disusered
Copy link
Owner

Yes this is typically due to permissions. I moved due to a family emergency
and my time is fairly limited so I have not had a chance to dive into this,
apologies.

On Mon, Oct 19, 2015 at 9:31 AM, TipsTrade Ltd. [email protected]
wrote:

I have the same issue - I'm assuming that it's a permission issue - the
file is being downloaded to your app's data directory, which is not
readable by other apps due to Android's sandboxing.


Reply to this email directly or view it on GitHub
#37 (comment)
.

Carlos

@disusered disusered added the bug label Nov 9, 2016
@BudgieInWA
Copy link

It should be possible to implement this on the native side using FileProvider as cordova-plugin-x-socialsharing does.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants