[File Viewer Plugin] Not working on Android 7 Nogut

[File Viewer Plugin] Not working on Android 7 Nogut

Forge Component
Published on 22 Aug by Experts
4 votes
Published on 22 Aug by Experts


I am using the downloaded file to open using the File Viewer Plugin.

It is working perfect with Android 5.1 but not working on Android-7.

I am using the Client Action of Plugin - CheckDocumentViewerPlugin & It return true on both device but still not working on Android-7.



I can confirm this issue.

Harlin Setiadarma wrote:

I can confirm this issue.


Did have any work-around for the same.

Outsystem should keep a documentation for each plugin on portal & also specify the version/platforms it supports, That would be much helpful for developers.

Sadly haven't found any workaround.


Harlin Setiadarma wrote:

Sadly haven't found any workaround.

I found a solution for the issue :)

Previous  I was downloading the file & providing the file path to the plugin, But now I am providing directly the URL to the plugin to open on remote.

What it does, It open it in chrome & download it & then open automatically in viewer.

It works on Andorid 5.1,6 & 7


Yep, I did that too...

But it's temporary workaround at best.

My client still not satisfied with this approach.

same issue here.

Issue persists.

It's the new security from Android Nougat now reject file:/// uri.

The native code in cordova github must be updated to use the new FileProvider approach.


Sharing Files Between Apps

For apps targeting Android 7.0, the Android framework enforces the StrictMode API policy that prohibits exposing file:// URIs outside your app. If an intent containing a file URI leaves your app, the app fails with a FileUriExposedException exception.

To share files between applications, you should send a content:// URI and grant a temporary access permission on the URI. The easiest way to grant this permission is by using the FileProvider class. For more information on permissions and sharing files, see Sharing Files.

It's fixed in the original cordova plugin: https://github.com/sitewaerts/cordova-plugin-document-viewer

But it's not compatible with Outsystems (I tried), so we all have to wait for this plugin developer to implement it.

Great news, it's been fixed. 

Check in Forge, go to File Viewer plugin, then check Version tab. 

Get version 1.2.0 (beta), it's working perfectly now.

Just pass file uri from File Plugin's SaveFile action.

You need to generate native APK again.

Thank you File Viewer Team for your time and effort.