for example k9-Mail will try to find a application to handle some attachments and uses the MimeType-Specification of the email.
For example with PDF it sends correct (debugging information):
12-27 15:41:58.992: I/ActivityManager(119): Starting: Intent { act=android.intent.action.VIEW dat=content://com.fsck.k9.attachmentprovider/01549957-459d-4ee3-b568-7e59390a9535/3/VIEW typ=application/pdf flg=0x3880001 cmp=com.adobe.reader/.AdobeReader } from pid 119
But if the mail attach the PDF not with MimeType "application/pdf" but with "'application/pdf'" it does not work. :-( This results in the broadcast:
12-27 15:35:15.007: I/ActivityManager(119): Starting: Intent { act=android.intent.action.VIEW dat=content://com.fsck.k9.attachmentprovider/01549957-459d-4ee3-b568-7e59390a9535/2/VIEW typ='application/pdf' flg=0x80001 } from pid 3635
The ' at beginning and end causes IMHO that no application is found to handle that. :-(
K9-Mail miss some other mappings to, so my idea was to build a little application, that catch the call and forward it. But for example the reader is not opened. I tried that:
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
Log.i(TAG, "Activity is called and created");
mapping.put("'application/pdf'", "application/pdf");
String type = getIntent().getType();
if (mapping.containsKey(type)) {
Log.i(TAG, "found mapping: " + type + " => " + mapping.get(type));
Log.v(TAG, "Intent before: " + getIntent().toString());
Intent i = new Intent(getIntent().getAction(), getIntent().getData());
i.setType(mapping.get(type));
i.setData(getIntent().getData());
i.setFlags(getIntent().getFlags());
Log.v(TAG, "Intent after: " + getIntent().toString());
startActivity(i);
}
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.i(TAG, "Activity is destroyed");
}
I think something with "cmd" is wrong ... because the debugger shows
12-28 08:38:51.445: V/ActivityForwardIntent(1195): Intent after: Intent { act=android.intent.action.VIEW dat=content://com.fsck.k9.attachmentprovider/01549957-459d-4ee3-b568-7e59390a9535/2/VIEW typ='application/pdf' flg=0x80001 cmp=de.blablupp.android.testproject/.ActivityForwardIntent }
Can someone help me? Is it possible, that the PDF-application can't get the content? But I can't see that the PDF-application is selectable or startet. :-(
One question is also - what means cmp? And how can I set this information to the new intent?
I hope to solve this problem, because it is really annoying to save the content and start it with file browser.
tia and reagards
nauni
Now I saw my mistake ... I was blind after trying so much ...
Log.v(TAG, "Intent after: " + getIntent().toString());
did log the wrong object :-( ...
Log.v(TAG, "Intent after: " + i.toString());
did the right logging, so I found the problem and now the application try to start the acrorad. So this problem is solved. Thanks!
The problem was to set the data and type with one command. So both is set correct and start the application. Set first one and with the next command the next will have no success.
i.setDataAndType(getIntent().getData(), mapping.get(getIntent().getType()));
Thanks for your attention, nauni
PS: But now I have a Problem with security permission ... but first I try to find a solution, before I ask something. ;-)