开发者

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

开发者 https://www.devze.com 2023-02-08 10:06 出处:网络
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:

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...


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号