Linking or IntentLauncherAndroid for open a downloaded file


#1

Hi,

I am trying to open downloaded files with the FileSystem API using SDK 32.0.0.

Linking.openURL('file:///data/user/….pdf');

Or

IntentLauncherAndroid.startActivityAsync(
    'android.intent.action.VIEW',
    null,
    'file:///data/user/….pdf'
);

And in the app.json file I configure the intent filters:

{
  "expo": {
    …
    "android": {
      …
      "intentFilters": [
        {
          "action": "VIEW",
          "data": {
            "scheme": "file",
            "host": "*",
            "pathPattern": ".*\\.pdf"
          },
          "category": [
            "BROWSABLE",
            "DEFAULT"
          ]
        }
      ]
    }
  }
}

I build, sign and install the standalone APK file correctly on the device:

$ expo build:android
$ adb install /Users/lya2/Downloads/app...-signed.apk

But I can’t make it open files…

In the Expo client I get the following error when open a file:

[Unhandled promise rejection: Error: file:///data/user….pdf exposed beyond app through Intent.getData()]

What do I do wrong? Has anyone been in this same scenario and has been able to solve it?

Regards,