Download and open file

Hi all,

I want to do the following:

  1. A file is downloaded to the app’s peristent storage.
  2. When the user taps a button, the downloaded file is opened with the default application (e.g. a pdf file).

Dowloading the file works well. I use the file-transfer plugin for this, In my callback function, I can see the file is stored at this location: file:///data/user/0/com.ionicframework.myionic2project470304/files/_OHAMBO/ionic-logo-blog.png

When I now try to open that file with the cordova-open plugin, the default application is loaded, but the file can not be found.

Any idea what I’m doing wrong?

thanks for your help,
Peter

to open files i used:

the location seems to be a private location which is only accessible by the app and other apps are denied access
you can store in a public folder using

file.externalDataDirectory

which will store the file in Android/data//files path which is public

1 Like