jmr
jmr

Reputation: 31

Android: How to use intent-filter to process a PDF email attachment?

I've been trying to have either the email or gmail applications give me the option of using my application to open a PDF attachments to no avail. My intent-filter looks like:

        <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 broadcasts this:

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 I'm I doing wrong?

Thanks in advance...

Upvotes: 3

Views: 2702

Answers (1)

Muundruul
Muundruul

Reputation: 713

I'm having a similar problem opening csv files from mail (Using Android 2.2). It finally worked using

<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 made it impossible to call my application from the e-mail application on opening the csv file.

You might also want to check Intent filter to download attachment from gmail apps on Android

Upvotes: 2

Related Questions