question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to open PDF file on Android 11 - targetSdkVersion 30

See original GitHub issue

Hello,

I’ve been using this library for quite some time in order to open PDF files. Recently, I’ve updated Android’s targetSdkVersion to 30, and I’ve noticed the actionViewIntent function is not functioning on Android 11. Using it as: android.actionViewIntent(filePath, `application/pdf`);

No error or whatsoever is thrown, so not really possible to debug.

Currently, asking for these permissions on AndroidManifest.xml:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

And have bothpreserveLegacyExternalStorage & requestLegacyExternalStorage set as true.

Using latest github:joltup/rn-fetch-blob#master version

Has somebody else faced this issue after updating? Am I missing some specific settings?

Thanks in advance.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:8

github_iconTop GitHub Comments

32reactions
Noithamcommented, Sep 28, 2021

I have found a solution. This library here is quite unmaintained, I’ve found some guys that are keeping it maintained and updated:

https://github.com/RonRadtke/react-native-blob-util

Had the same issue tho with that library, but found out a solution: https://github.com/RonRadtke/react-native-blob-util/issues/66

Basically adding:

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:mimeType="*/*" />
        </intent>
    </queries>

on the AndroidManifest.xml

Hope that makes it work for you guys, and definitely recommend switching to use the new maintained library!

2reactions
HectorEncisocommented, Sep 27, 2021

I have the same problem, any solution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

PDF.js can't show PDF from externalFilesDir at Android 11
I am using PDF.js to show PDF files inside my Android App. Up to Android 10 it worked fine, but starting with "targetSdkVersion...
Read more >
Cannot create PDF files in Android 11 (Permission denied)
I am trying to create PDF with the nuget Syncfusion.Xamarin.Pdf version 19.3.0.47 and with Xamarin.Forms version 5.0.0.2196, ...
Read more >
Fulfill common use cases while having limited package visibility
This section describes various ways to open URLs in an app that targets Android 11 or higher. Open URLs in a browser or...
Read more >
[Android 11 DP/Beta] With READ_EXTERNAL_STORAGE ...
gradle, and all works normally. ... Then edit the app module build.gradle file, change targetSdkVersion to 29 and run the sample again. This...
Read more >
Use of All files access (MANAGE_EXTERNAL_STORAGE ...
This is only applicable to apps that target Android 11 (API level 30) and declare the MANAGE_EXTERNAL_STORAGE permission, which is added in Android...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found