354
Views
16
Comments
Solved
[File Viewer Plugin] Not working on Android 7 Nogut
file-viewer-plugin
Mobile icon
Forge asset by OutSystems

Hi,

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.


Thanks,

Assif

2021-04-09 11-42-43
assif_tiger
 
MVP
Solution

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


2024-03-25 06-19-08
Harlin Setiadarma

I can confirm this issue.

2021-04-09 11-42-43
assif_tiger
 
MVP

Harlin Setiadarma wrote:

I can confirm this issue.

Yes,

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.



2024-03-25 06-19-08
Harlin Setiadarma

Sadly haven't found any workaround.

2021-04-09 11-42-43
assif_tiger
 
MVP
Solution

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


2024-03-25 06-19-08
Harlin Setiadarma

Yep, I did that too...

But it's temporary workaround at best.

My client still not satisfied with this approach.

UserImage.jpg
Guilherme Jesus

same issue here.

UserImage.jpg
John Smith

Issue persists.

2024-03-25 06-19-08
Harlin Setiadarma

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.

https://developer.android.com/about/versions/nougat/android-7.0-changes

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.

2024-03-25 06-19-08
Harlin Setiadarma

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. 

2018-03-05 03-47-24
Anggun Nurani

Harlin Setiadarma wrote:

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. 

I follow your step, but when i generate native apk, i have an error installing cordova plugin


2021-04-09 11-42-43
assif_tiger
 
MVP

Harlin Setiadarma wrote:

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. 

Thanks Harlin for the Update.

Will Check it definitely but again now I have to check it on OS-11.


Cheers


2024-03-25 06-19-08
Harlin Setiadarma

It worked for me before using version 1.2.0 and Outsystems 10.

I haven't test the new version 1.2.1 or using Outsystems 11.



UserImage.jpg
Adrian Holland

Hi,

Can anyone please confirm this fix work for Outsystems 11 with Android 7.0 / 8.0?

For me it works fine on iOS, and Android 6.x but not Android 7.x, 8.x.

In all Android OS versions I've tested, a PDF file is created successfully in the target folder by the File Plugin: eg

file:///storage/emulated/o/Android/data/com.outsystemscloud.uotscdev.USCAPP/files.com/outsystemscloud/uotsc-dev/Great%20WaIk%20Topographic%20Map.pdf


In Android 6.x the file viewer plugin opens and views the pdf correctly in an external viewer from this location.


In Android 7.x,8.x the file is unable to be opened by any of the external pdf viewers launched from the app.

eg Adobe reports "The file could not be accessed Check the location or the network and try again"


If I navigate to the created pdf in storage myself, I can successfully use a PDF viewer to view the file so it has been created Ok.

The plugin confusingly reports success in launching the external viewer so perhaps its not setting permissions correctly (I can't see what the permissions are on the file)

I can confirm I'm using the latest version of the File Viewer Plugin as of 07/02/19

If anyone out there has any clues, I'd love to hear them.


Thanks,

Adrian

2024-03-25 06-19-08
Harlin Setiadarma

Use Android Runtime Permission plugin from Forge.


Use it to request permission for these two:

1. READ_EXTERNAL_STORAGE

2. WRITE_EXTERNAL_STORAGE


Starting with Android 7, you need to request permission at runtime.

UserImage.jpg
Adrian Holland

Thanks very much for the suggestion Harlin, I have added the plugin then put in logic to check for and apply the permissions as per below (I couldn't find an easy way to request both permissions at once) so have chained them.

This prompts for permissions access and brings up the dialog for the user to grant permissions but I still see the same problem after permission is granted. ie the file is unable to be opened. :( 

UserImage.jpg
Nave Jothi

Hi,

I am using Fileviewerplugin is not working in Android version 10.I got the error, when I opening the attachement.

There is no error message and it is not logged in the Service Center. It can however be output as a drop down message using the output of the FileViewerPlugin Logic.

What I receive is Success = "False", ErrorCode = "", ErrorMessage = "".


thanks,

Jothi

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