Android - Opening gmail attachment with my App
<p>I need to open files with custom extension using my app. I am able to do this using Intent filters when the file is in my sd card. I can also view the 'download' and 'preview' buttons if the file is sent as a Gmail attachment. However, when I clicked the download/preview buttons, I got the message - <strong>"Sorry, the attachment could not be downloaded"</strong>. </p>

<p>I thought this was an issue with my app. But I had a random idea and installed "Download All Files" app on my phone.
<a href="https://play.google.com/store/apps/details?id=com.hwkrbbt.downloadall&amp;hl=en" rel="nofollow">https://play.google.com/store/apps/details?id=com.hwkrbbt.downloadall&amp;hl=en</a>
Then, when I click download button in Gmail, both Download All Files and My App are proposed for downloading the file. I chose my app, and everything works fine!! </p>

<p>Is this some security issue? 
These are my Intent Filters:</p>

<pre><code>&lt;intent-filter &gt;
         &lt;action android:name="android.intent.action.VIEW" /&gt;
         &lt;category android:name="android.intent.category.DEFAULT" /&gt;
         &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
         &lt;data android:mimeType="*/*" /&gt;
         &lt;data android:scheme="content" android:host="*"
            android:pathPattern=".*\\.ate" /&gt;
        &lt;data android:scheme="file" android:host="*"
            android:pathPattern=".*\\.ate" /&gt;
    &lt;/intent-filter&gt;
    &lt;intent-filter&gt;
        &lt;action android:name="android.intent.action.VIEW" /&gt;
        &lt;category android:name="android.intent.category.DEFAULT" /&gt;
        &lt;data android:mimeType="application/*" host="*" android:pathPattern=".*.ate" android:scheme="content" /&gt;
    &lt;/intent-filter&gt;
</code></pre>

<p>EDIT: Here's the full activity tag.</p>

<pre><code>  &lt;activity android:name=".TestApp"
              android:label="@string/app_name" 
              android:configChanges="orientation|keyboardHidden"
              android:launchMode="singleTask"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="com.TestApp.TestApp.NOTIFICATION" /&gt;
            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
        &lt;/intent-filter&gt;
        &lt;!-- Opening .ate file start --&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.VIEW" /&gt;
            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
            &lt;data android:scheme="file" /&gt;
            &lt;data android:host="*" /&gt;
            &lt;data android:pathPattern=".*\\.ate" /&gt;
          &lt;/intent-filter&gt;
    &lt;intent-filter &gt;
         &lt;action android:name="android.intent.action.VIEW" /&gt;
         &lt;category android:name="android.intent.category.DEFAULT" /&gt;
         &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
         &lt;data android:mimeType="*/*" /&gt;
         &lt;data android:scheme="content" android:host="*"
            android:pathPattern=".*\\.ate" /&gt;
        &lt;data android:scheme="file" android:host="*"
            android:pathPattern=".*\\.ate" /&gt;
    &lt;/intent-filter&gt;
    &lt;intent-filter&gt;
        &lt;action android:name="android.intent.action.VIEW"/&gt;
        &lt;category android:name="android.intent.category.BROWSABLE"/&gt;
        &lt;category android:name="android.intent.category.DEFAULT"/&gt;
        &lt;data android:scheme="file" android:pathPattern=".*\\.ate" android:mimeType="application/octet-stream"/&gt;
        &lt;data android:scheme="content" android:pathPattern=".*\\.ate" android:mimeType="application/octet-stream"/&gt;
        &lt;/intent-filter&gt;
        &lt;!-- Opening .ate file end  --&gt;
    &lt;/activity&gt;
</code></pre>
