I'm trying to create a default handler for .p7s/.p7b files in Android.
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.
Just as a basic test I've been trying something like this:
Manifest.xml
<receiver android:name=".IntentReceiver" android:enabled="true">
<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/x-pki-signature"/>
</intent-filter>
</receiver>
Class file.
public class IntentReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("TEST", "Intent was caught");
//Do something here
}
}
I've tried using the following mimeType filters as well (testing signatures first):
application/pkcs7-signature
application/x-pkcs7-signature
application/keychain_access
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?