When trying to open a document

Hi


FOR Mobile Application:

I have made a button and on click of that button I want to open a document.

There are two scenarios:

1.) If the document is on another server and we only have a url for it.

  For eg: 

SyntaxEditor Code Snippet

https://file-examples.com/wp-content/uploads/2017/02/file-sample_1MB.doc

2.) If the document is in resource folder of outsystems.


For both the cases

 If I were to click on the button, I want to open the default pop up which have various options as to in which preinstalled application you want to open this file like when we want to send a message pop up shows various apps through which we can send a particular message.  How can I achieve this functionality?

Hi Shubham,

For opening the file using app selection, you have to first save the file on device and then open it

To save the file  you can use fie plugin plugin from forge

https://www.outsystems.com/forge/component-overview/1633/file-plugin

and then open that file using file opener plugin on forge

https://www.outsystems.com/forge/component-overview/5224/file-opener

Nikhil Gaur wrote:

Hi Shubham,

For opening the file using app selection, you have to first save the file on device and then open it

To save the file  you can use fie plugin plugin from forge

https://www.outsystems.com/forge/component-overview/1633/file-plugin

and then open that file using file opener plugin on forge

https://www.outsystems.com/forge/component-overview/5224/file-opener

Hi Nikhil 

If I have to open the doc in one of the pre-installed application(other than the outsystems one) in the mobile, then do I have to  still download the file?


Hi Shubham,

Yes, in most of the cases you have to download the file to open them in preinstalled apps.

There may be some apps which support opening of file through URL that too for specific file types but internally they will also save the file on device and then open.

Nikhil Gaur wrote:

Hi Shubham,

For opening the file using app selection, you have to first save the file on device and then open it

To save the file  you can use fie plugin plugin from forge

https://www.outsystems.com/forge/component-overview/1633/file-plugin

and then open that file using file opener plugin on forge

https://www.outsystems.com/forge/component-overview/5224/file-opener

Hi Nikhil,

I am facing trouble saving and opening pdf files using these two plugins for quite a while now and i still cant figure out how to use the plugins correctly. I have attached an oml of what i am currently doing, do you mind taking a look at it?

Edit: The 2 plugins i am trying to use is file plugin and file viewer plugin.


Shubham Agarwal wrote:

Hi


FOR Mobile Application:

I have made a button and on click of that button I want to open a document.

There are two scenarios:

1.) If the document is on another server and we only have a url for it.

  For eg: 

SyntaxEditor Code Snippet

https://file-examples.com/wp-content/uploads/2017/02/file-sample_1MB.doc

2.) If the document is in resource folder of outsystems.


For both the cases

 If I were to click on the button, I want to open the default pop up which have various options as to in which preinstalled application you want to open this file like when we want to send a message pop up shows various apps through which we can send a particular message.  How can I achieve this functionality?


Hi Shubham,
I have made available a sample on forge that covers the scenarios you are looking for, I believe. 

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


I hope it helps.

Otávio. 

Hi Shubham Agarwal,

Despite the above good solutions, I would recommend you go for the below easiest & feasible solution where you don't even need to download the file & it just loads instead downloading in the device.

1-  I used one of my plugin Safari View And Custom Chrome Tab
      https://www.outsystems.com/forge/component-overview/5311/safari-view-and-custom-chrome-tab


2- That's it !!, Now I pass the Request URL to the action & the value as below:

SyntaxEditor Code Snippet with your URL provided in the post :

"https://docs.google.com/viewer?url=file-examples.com/wp-content/uploads/2017/02/file-sample_1MB.doc"


3- And here we go for the end- result  [ Android Device ]:

 The plugin opens the browser within the application. You can read the features on the plugin doc.


Using the below trick to render any document which is on any server :)

SyntaxEditor Code Snippet

https://docs.google.com/viewer?url=


4- Download the sample from here :
https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=5318
And just replace the request-URL & you can test.
you can also concatenate the URL variable to function & prepare dynamic requests.


Cheers,

Assif