File Plugin and File Viewer Plugin on Android Device

Good Day Community, 

I am currently learning to implement File Plugin and File Viewer Plugin for an offline mobile application. The goal is to save the file locally on the device and then be fetched by the mobile application for viewing on the mobile application itself.

The attached data is of type pdf by the way. 

The following situations have been tested on a mobile device installed as an apk. 

The problem I have is using the actions properly. I have a button for Saving the File, Getting the File and Viewing the File. On [Saving the file] I am not receiving any error. On [Getting the File], "File Not Found is returned". Finally on [Viewing the File] nothing is happening. 


Rank: #112

Hi Leonard,

Hope you're doing well.

As far as I can tell, I believe you need to change a couple things :)

The first thing you should care about is the location on the device where you want to save your file. Android and iOS devices have different file system layouts. According to this documentation, you can see the directories that you may use.

So I would advise you to create an action (I created one called GetFilePath for this purpose) to check which type of device are you working with and specify the path accordingly. Something like this:

The defined path is not really that important in this scenario, since you just want to save the file properly in the device and get the location (URI) where it was saved.

About your SaveFile action, it seems to be correct, you just need now to adapt the file path (calling previous action):

If you just need to open your file, you don't need to use GetFileData action, because SaveFile action already returns the URI (path) where the file was saved :)

So, you just need to use this returned URI directly into OpenDocument action.

Your mimeType should be "application/pdf" and not "pdf" :)

I created a new action in your application called SaveAndOpenAction, which is going to save the file and open it directly with this logic.

Please refer to attached OML file. You can test it and let me know :)

Hope that this helps you!

Kind regards,

Rui Barradas