formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

Tap on files list not downloading the file in cordova app

Open raghavendrav6 opened this issue 6 years ago • 4 comments

In a form we have a list of files. In browser when we tap on it it's downloading the file. But in cordova app when we tap on the file name nothing happens.

So, for us to able to download the file do we need to do something? or Is it even supported?

raghavendrav6 avatar Jun 17 '20 10:06 raghavendrav6

We don't have any reason to think this shouldn't work. Is there an error happening within the app or something?

randallknutson avatar Jun 17 '20 20:06 randallknutson

First, make sure the application has the storage permissions enabled. If the app is not permitted to access the phone's storage it will block all attempts to access it (like saving a new file).

IF that is not the case, it would seem to be a misconfiguration on the cordova side. Make sure to enable the file / media and permissions plugin. For Android, for example, make sure to have the following in your build script:

cd /path/to/cordova/dir

cordova plugin add cordova-plugin-android-permissions && \
cordova plugin add cordova-plugin-file --force && \
cordova plugin add cordova-plugin-media && \
cordova plugin add cordova-plugin-camera
  • cordova-plugin-android-permissions: Enables Android phone permission request.

  • cordova-plugin-file: Enables the file plugin allowing you to access or creating files (use --force to make sure no other option disables it).

  • cordova-plugin-media: Enables the media plugin allowing you to access photo gallery (saving / reading media files).

  • cordova-plugin-camera: Enables the camera plugin allowing you to use your phone camera to take pictures with file component.

You may also want to use the cordova-plugin-whitelist if you wish to control the URLs your app is allowed to access (security measure).

airarrazaval avatar Jun 18 '20 00:06 airarrazaval

I have developed a custom Storage Provider for Firebase Storage that works like a charm on the web, however, when opening the form at the ionic cordova App the downloading part doesn't seem to work. I am just not able to do the downloading part, previewing images works perfectly.

I've checked that the storage permission is enabled. I've also checked that the plugins are installed, except cordova-plugin-whitelist as I understand that it is optional. What else I might be missing?

There is no error message and the HTTP request for getting the file seems to be correctly done. Could I be missing something for formio to save the file to the Android device?

MiguiTE avatar Apr 04 '22 14:04 MiguiTE

Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!

Tatsiana8 avatar Feb 14 '24 14:02 Tatsiana8