1

In my app, I download and save a file to my app's cache directory (e.g. file:///data/user/0/.../cache/5f8f.../downloaded.pdf) and try to open this file using WebView. My WebView code is:

<WebView
  source={{ uri: file.uri }}
  startInLoadingState
  originWhitelist={['file://']}
  allowUniversalAccessFromFileURLs={true}
  allowFileAccess={true}
/>

On iOS, it works fine. However, on Android, it prints ERR_ACCESS_DENIED.

I've tried some solutions found on GitHub and StackOverflow:

, but still not working on my case.

Any other solution to solve my problem? Thanks, in advance. If you need more code to investigate, please let me know.

== edit: file.uri looks like file:///data/user/0/.../cache/5f8f.../downloaded.pdf. It is a file stored on the cache directory.

byron1st
  • 969
  • 1
  • 13
  • 35

1 Answers1

1

A Webview on Android cannot display a pdf document.

blackapps
  • 8,011
  • 2
  • 11
  • 25