Creating a default viewer / receiver for Android email attachments
<p>I'm trying to create a default handler for .p7s/.p7b files in Android.</p>

<p>I figured the best start would be to create a BroadcastReceiver that will capture the intent from the Android email application (or K-9 if that's a need) for opening of certain attachments (filtered by mime type). Specifically I'm trying to handle s/mime email so looking for the "application/x-pkcs7-certificates" and "application/x-pkcs7-certificates" mime types.</p>

<p>Just as a basic test I've been trying something like this:</p>

<p>Manifest.xml</p>

<pre><code>&lt;receiver android:name=".IntentReceiver" android:enabled="true"&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="application/x-pki-signature"/&gt;
     &lt;/intent-filter&gt;
&lt;/receiver&gt;
</code></pre>

<p>Class file.</p>

<pre><code>public class IntentReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d("TEST", "Intent was caught");
        //Do something here
    }
}
</code></pre>

<p>I've tried using the following mimeType filters as well (testing signatures first):</p>

<pre><code>application/pkcs7-signature
application/x-pkcs7-signature
application/keychain_access
</code></pre>

<p>I can't seem to get the IntentReceiver class to capture the intent no matter what filtering I use though. Am I going about this the wrong way?</p>
