This is very annoying, so I just submitted a bug/issue at
http://code.google.com/p/android/issues/detail?id=3611
You can go there and "star" the issue to get notified on updates.
I also looked into the source of the Email app. It's completely
incredible how many layers of indirection are involved after clicking
on the "download" button (which will not even be visible if the media
type is not supported) or the "preview" button. It finally ends up in
com.android.email.activity.MessageView.Listener.loadAttachmentFinished
(Account, Message, Part, Object) and if this is NOT a "download", then
this code will be executed (at least I think so, I currently can't
debug it):
Uri uri = AttachmentProvider.getAttachmentUri(
mAccount,
attachment.part.getAttachmentId());
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
intent.addFlags
(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);
As you can see, there is no intent.setType(), so any IntentFilter that
filters by type will not receive this intent.
On 16 Aug., 08:20, Nivek <[email protected]> wrote:
> Any idea about how to get the real name of the attached file ?
>
> Nivek
>
> On 10 juil, 19:13, Alexey Krasnoriadtsev <[email protected]>
> wrote:
>
> > You are correct that you should use contentResolver.openInputStream
> > (uri), to get the data fromgmailattachments.
>
> > DefaultEmailapp, is very dumb and is hardcoded to only open audio
> > and imageattachments.
> > (disclaimer, that was the case 6 month ago, the last time i looked at
> > it).
>
> > On Jul 8, 10:16 am, Mirko Nasato <[email protected]> wrote:
>
> > > Hi all,
>
> > > I've written an app that can handle the VIEW action for a given
> > > mimeType, say "application/foo". By adding the following to
> > > AndroidManifest.xml the Browser automatically uses my app to open
> > > downloads of that type:
>
> > > <intent-filter>
> > > <action android:name="android.intent.action.VIEW"/>
> > > <category android:name="android.intent.category.DEFAULT"/>
> > > <data android:mimeType="application/foo"/>
> > > </intent-filter>
>
> > > TheGMailapp also tries to use my app to Previewattachmentsof that
> > > type, but it's passing a URI with scheme "gmail-ls://" rather than a
> > > "file://" URI. I guess I need to use a ContentProvider to get the
> > > attachment data, I haven't looked into that yet.
>
> > > But the real mystery is theEmailapp... there just doesn't seem any
> > > way to make it open theattachments.
>
> > > Any pointers? Openingattachmentsis a very common requirement of
> > > course, and I would expect the Android platform to encourage
> > > developers to write apps to handle more mime types. Instead I couldn't
> > > find any answers:
>
> > > http://groups.google.com/group/android-developers/browse_thread/threa...
> > > http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > > Thanks
>
> > > Mirko
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---