I have a React Native app in which at some page I've got a web view (react-native-webview
) for displaying PDFs from our server.
In iOS everything works fine, in Android, whenever I try to view the file I got:
Cannot downoad files as permission was denined. Please provide permission to write to storage, in order to download files.
I've then added <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
to my manifest. Now, I'm getting the following alert:
I think it's pretty scary and very stupid from a user experience perspective. I'm not accessing photos, media, or files, all I'm trying to do is to display a simple PDF inside a web view. I don't want my users to be presented such alert.
When I tap allow, it says Downloading...
and downloads the PDF like a file that can be opened outside my app. I don't want this behavior, I want PDF to render inside web view just like iOS does.
How can I display PDFs in Android using React Native web view, without a scary dialog which has nothing to do with what I'm actually trying to do?
(I'm on React Native 0.59.9, Android 8.1, Android SDK 28, react-native-web-view
5.12.0)