-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
I'm trying to open a pdf document with FileView.open(filePath) and the filePath is like /data/user/0/com.myapp.dev/attachments/Copies/my_doc.pdf (in Android)
The codes work perfectly fine in iOS, but it is failing in Android and throwing the following error:
Failed to find configured root that contains /data/data/com.myapp.dev/attachments/Copies/my_doc.pdf.
It is failing in this particular line in the RNFileViewerModule.java file from my bebugging:
contentUri = FileProvider.getUriForFile(currentActivity, authority, newFile);
Here's some additional infomation:
- I have verified that the original file path exists, and I can open it in webview just fine.
- I have granted
WRITE_EXTERNAL_STORAGEpermission to my app - App is on React Native 0.76.6
- Testing on Android 11
- I have added the
queriestag in the AndroidManifest.xml as suggested in the documentation:
<manifest ...>
<queries>
<intent>
<action android:name="android.intent.action.VIEW"/>
<data android:mimeType="*/*"/>
</intent>
</queries>
<application...>
........
</application>
</manifest>
I have no idea why it is looking into /data/data/ directory instead of the given /data/user/ directory. Any suggestion to resolve this error?
manosKas and nugetrenki
Metadata
Metadata
Assignees
Labels
No labels