Android: How to use an intent filter to process PDF email attachments?

I am trying to have e-mail or gmail applications give me the opportunity to use my application to open PDF attachments to no avail. My filter intent is as follows:

        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT" /> 
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:mimeType="application/pdf" />
        </intent-filter>

When I look in the emulator, the activity manager sends this message:

02-04 15:45:03.626: INFO/ActivityManager(59): Starting activity: Intent { act=android.intent.action.VIEW dat=content://com.android.email.attachmentprovider/1/17/RAW flg=0x80001 }

What am I doing wrong?

Thanks in advance...

+3
source share
1 answer

I had a similar problem with opening csv files from mail (using Android 2.2). He finally worked with

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="*/*" android:host="*" android:pathPattern=".*.csv" />
</intent-filter>

Changing anything in the data tag did not allow my application to be called from the email application when I opened the csv file.

Intent gmail Android

+2

Source: https://habr.com/ru/post/1790082/


All Articles