【问题标题】:Open app for specific filetype (from email attachment)打开特定文件类型的应用程序(来自电子邮件附件)
【发布时间】:2013-10-25 13:57:19
【问题描述】:

根据我的研究,支持将过滤器应用于 Activity 的文件类型就足够了,

<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:scheme="https" android:host="*" android:pathPattern=".*\\.filetype"/>
          <data android:scheme="http" android:host="*" android:pathPattern=".*\\.filetype"/>
          <data android:scheme="file" android:host="*" android:pathPattern=".*\\.filetype"/>
          <data android:scheme="content" android:host="*" android:pathPattern=".*\\.filetype"/>
</intent-filter>

但它不适用于电子邮件附件。当尝试打开附件时,它只显示一条消息,即找不到此文件类型的支持应用程序。

这段代码适用于电子邮件附件,

<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:pathPattern=".*\\.fileType" />
                <data android:host="*" />
                <data android:mimeType="application/*" />
</intent-filter>

但是对于这个过滤器,我的应用程序会出现在任何类型的文件类型中。

所以我的问题是,

1.用我的应用打开电子邮件附件的正确方法是什么?以便 myapp 尝试仅针对特定文件类型打开。

【问题讨论】:

    标签: android mime-types email-attachments


    【解决方案1】:

    您需要一个默认的启动器来根据类型启动。

    <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.gosylvester.bestrides.ImageTextListViewActivity" />
    
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
    
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.DEFAULT" />
    
                <data android:mimeType="application/vnd.google-earth.kml+xml" />
            </intent-filter>
        </activity>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-03
      • 1970-01-01
      • 1970-01-01
      • 2013-06-27
      相关资源
      最近更新 更多