Search code examples
androidcordovacordova-plugins

How to open locally saved files on cordova android


I have a cordova application, which is caching a few files in the local file system, which I suppose is working (because on ios there are no problems at all and on android I can see the cached images).

The problem is, when I want to display the PDF files on android (no matter if I use the inappbrowser plugin or cordova-plugin-file-opener2) the external window opens shortly and closes then immediatelly. In Android studio I get the following error message: E/Surface getSlotFromBufferLocked: unknown buffer: 0x96b20cc0

If you search about that error, you get many posts about permission problems. But I dont know which permission I could need.

Here is how I am opening the pdf files:

window.open("file:/// .... ", "_system");

Solution

  • When I was changing the data directory in the cordova-plugin-file it was working:

    Cordova open local Pdf file on Android