1

I am downloading a pdf document through our application and I want to prompt the user on how they wish to open it. I have tried the Launcher class that is available but I keep getting the following error message: No Activity found to handle Intent {act=android.intent.action.VIEW dat=pdf:///storage/emulated/0/filename.pdf flg=0x14000000 }

This is the method that I am using. await Launcher.Default.OpenAsync($@"pdf://{filePath}");

This is in my Android Manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:networkSecurityConfig="@xml/network_security_config" android:requestLegacyExternalStorage="true">
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>
    </application>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.FLASHLIGHT" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
    <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="http"/>
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="https"/>
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="file"/>
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="pdf"/>
        </intent>
    </queries>
</manifest>

Am I missing setup in my Android Manifest file or the start up of my application?

GANDA1F
  • 307
  • 1
  • 4
  • 13
  • Do you want to open the downloaded pdf in your app? – Jessie Zhang -MSFT Mar 24 '23 at 08:14
  • @JessieZhang-MSFT no I want to open the application with the default app on the device. – GANDA1F Mar 24 '23 at 09:11
  • `I want to open the application with the default app on the device.` Sorry, I don't quite understand what you mean. What's the `the application` and the `the default app` ? Can you explain in detail? – Jessie Zhang -MSFT Mar 28 '23 at 09:23
  • I need to open a pdf but I want to prompt the user to select the application they wish to use. Like when you download a PDF through your browser and then wish to open it, it will ask which app to use if there are perhaps more than one. – GANDA1F Mar 29 '23 at 10:04

0 Answers0