726
Views
21
Comments
Solved
Does anyone have a step by step to download file via Mobile App?
Application Type
Mobile

Hello people,

I created the complete procedure to generate an Excel file from an entity, but unfortunately, the download widget does not exist for the mobile application ...

I installed by FORGE, file plugin and file transfer plugin and I was able to create the download screen using these plugins.

I am a beginner in OutSystems a and I did not find in the forum, material that is clear and objective.


Can you help me?

Marcelo Sampaio

 
MVP
Solution

From your screenshot, it seems that you are restricted on android 11 because updated security so only the app that have that folder can access that folder.

You should use additional app for browsing this folder.

https://forum.xda-developers.com/t/android-11-cannot-access-android-data-folder.4225293/


 
MVP

Hi,


This is simplified download file :

1. Create server action for creating excel binary, in my example, I create excel from Users entity

So, aggregate Users entity, then use widget RecordListToExcel from Users aggregate, then assign to output type Binary data.

2. On screen button on click, call the server action that created on step 1, then add SaveFile from File plugin


That's it


Thanks

Hello Toto,


I did the procedures you requested me and nothing happens. Could you confirm the procedures in the attached file and tell me what's going on? The screen to be used is:

And button for action and execution is:

Thank you if you can help me with this, because I am still beginner and I need to learn at least the basics.


Marcelo Sampaio

BellaNapoli.oml

Hello Marcelo,

It could be because the Save Action => Path property is blank. Toto may have just left it blank for demonstration purposes. Please provide a path where you would like the file to be downloaded and see if that works.

Regards,

AJ

I put it on Path:

"Folder/Mydocs"



And yet, it shows nothing to download ...


Hello Marcelo,

Based on your screenshots it seems that you are testing your app in the browser. If you use mobile plugins, then you can only test its functionality on a device.

If you were testing in a browser, then your servicecenter logs are probably reporting a 'cordova plugin is not defined' error. If so, please review this post for relevant information.

Best regards,

AJ

Hello Aj.

I tested directly on cell phone too, but unfortunately, nothing happens ...

Hello Marcelo, try the File Viewer Demo!!, you have a lot of samples, and maybe you can test how to download files to your mobile. Also, you have a lot of other situations that you can see happening on those samples!

But have a look, I am going to have a look too!!

What I can see on the samples, is that they have really good ways/best practices to do things. I could manage to open the excel with this and save it. :)

https://www.outsystems.com/forge/component-overview/8322/fileviewerdemo

Hello Márcio,

Unfortunately it did not work, but I noticed testing that there is no creation of the folder in SaveFile action.

Hi Marcelo,

I tried to implement the same use case, and it is working as expected for the Android device (I didn't tested in iOS).

Points to note:

  • Make sure you re-generate and re-install the application after adding the FilePlugin dependencies.
  • Allow the application to access device storage, i.e. grant storage permission.
  • In the SaveFile client action, specify the path property value and the Name property value along with the file extension.
  • I have observed that the exported file gets stored in the Internal Storage even though the SaveFile action StogrageTypeId property is set to external.
  • After exporting the excel file, check the downloaded file in the Internal Storage > Android > data directory in the phone device.
  • More specific path for my case: Internal Storage > Android > data > (OS_Env_Name) > files > MyDocs > ExcelDownload


I hope this helps you!


Kind regards,

Benjith Sam

Hello Benjith,

I tried to follow your procedures and nothing happened. Could you send me your .oml file as an example to see what I can be doing wrong? In my routine I did not find mistakes and even erased so much anger ...

Hi Nova,

Refer to the attached .oml file


I hope this helps you!


Kind regards,

Benjith Sam

MobileLabExportXL.oml

Hi Benjith...

I followed all your procedures, that is, equally in everything, and it did not help ... I am sharing my .oml file to verify everyone who wants to help me, because I do not know what else to do and besides, I am a beginner ...

Thanks,

Marcelo Sampaio

 
MVP

Hi,


Sorry, on weekend I didn't open my laptop.

1. you cannot test this using emulator chrome, you must test on the device (because FilePlugin is using cordova plugin)

2. The file if put empty on the path, it'll go to default folder, that is : you app id (example : com.outsystemscloud.xxx.appname) so on android it'll on this folder : Android/data/com.outsystemscloud.xxx.appname/files


Thanks

Hello Toto,

I tried everything and all the information above, but unfortunately, it does not work ...

 
MVP
BellaNapoli.oml
 
MVP

Hi, 

Your code is already work, the file is saved on the device.

I build the android app and press the download from screen "Relatio"

Hello Toto,

On my device nothing appears. I have a Galaxy S10...

 
MVP
Solution

From your screenshot, it seems that you are restricted on android 11 because updated security so only the app that have that folder can access that folder.

You should use additional app for browsing this folder.

https://forum.xda-developers.com/t/android-11-cannot-access-android-data-folder.4225293/


Hello Toto...

Perfectly. I had to download the total commander on Google Store to find the file ...

Thank you...

Yes, here's how to download a file using a mobile app step-by-step:

    Check out the app on your phone.
    Go to the file that you wish to download.
    To pick the file, tap on it.
    Search for a download or save option, which is typically indicated by an arrow or cloud.
    Select the option to download.
    The file will begin to download, and the notification bar will allow you to track its progress.
   

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.