[android-developers] Re: Associate app to open email attachments

2009-08-20 Thread brian.schimmel

This is very stange... I experienced the same problems that you for
some days, and now after comlaining and submitting a bug, it suddently
works without any changes to my code. In my case, I setup a
IntentFilter for some Mime Types, and opened an attached VCF-File in
the Email App with the "Open" Button. It starts my activity in this
way:

Starting activity: Intent { action=android.intent.action.VIEW
data=content://com.android.email.attachmentprovider/f70bd905-0a85-4355-
a56f-a41ef6e20100.db/222/RAW flags=0x1 comp={com.companyname/
com.companyname.ActivityName} }

So everything is fine with the "Email" app. Even the Mime type is
somehow getting through (that is, I think so, because how else would
Android know to delegate this Intent to my app?)

But I still experience the same problems with the Gmail App. It
supplies a "Preview" button and a click starts a download but yields
"The attachment could not ne fetched because this type of file cannot
be displayed on the phone." Maybe I need to adjust my IntentFilter to
handle the file:// protocol, I'll try that and report about it.


On 20 Aug., 17:28, "brian.schimmel" 
wrote:
> This is very annoying, so I just submitted a bug/issue 
> athttp://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 theEmailapp. 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  wrote:
>
> > Any idea about how to get the real name of the attached file ?
>
> > Nivek
>
> > On 10 juil, 19:13, Alexey Krasnoriadtsev 
> > 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  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:
>
> > > >   
> > > >      
> > > >      
> > > >      
> > > >   
>
> > > > 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Associate app to open email attachments

2009-08-20 Thread brian.schimmel

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  wrote:
> Any idea about how to get the real name of the attached file ?
>
> Nivek
>
> On 10 juil, 19:13, Alexey Krasnoriadtsev 
> 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  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:
>
> > >   
> > >      
> > >      
> > >      
> > >   
>
> > > 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Associate app to open email attachments

2009-08-20 Thread brian.schimmel

As kevin.gaudin pointed out in reply to my bug report, it worked for
me because VCard is in the list of allowed Mime Types because it fits
text/*. So there is still no solution for application/*.

On 20 Aug., 17:42, "brian.schimmel" 
wrote:
> This is very stange... I experienced the same problems that you for
> some days, and now after comlaining and submitting a bug, it suddently
> works without any changes to my code. In my case, I setup a
> IntentFilter for some Mime Types, and opened an attached VCF-File in
> the Email App with the "Open" Button. It starts my activity in this
> way:
>
> Starting activity: Intent { action=android.intent.action.VIEW
> data=content://com.android.email.attachmentprovider/f70bd905-0a85-4355-
> a56f-a41ef6e20100.db/222/RAW flags=0x1 comp={com.companyname/
> com.companyname.ActivityName} }
>
> So everything is fine with the "Email" app. Even the Mime type is
> somehow getting through (that is, I think so, because how else would
> Android know to delegate this Intent to my app?)
>
> But I still experience the same problems with the Gmail App. It
> supplies a "Preview" button and a click starts a download but yields
> "The attachment could not ne fetched because this type of file cannot
> be displayed on the phone." Maybe I need to adjust my IntentFilter to
> handle the file:// protocol, I'll try that and report about it.
>
> On 20 Aug., 17:28, "brian.schimmel" 
> wrote:
>
> > This is very annoying, so I just submitted a bug/issue 
> > athttp://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 theEmailapp. 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  wrote:
>
> > > Any idea about how to get the real name of the attached file ?
>
> > > Nivek
>
> > > On 10 juil, 19:13, Alexey Krasnoriadtsev 
> > > 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  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:
>
> > > > >   
> > > > >      
> > > > >      
> > > > >      
> > > > >   
>
> > > > > 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Associate app to open email attachments

2009-08-15 Thread Nivek

Any idea about how to get the real name of the attached file ?

Nivek

On 10 juil, 19:13, Alexey Krasnoriadtsev 
wrote:
> You are correct that you should use contentResolver.openInputStream
> (uri), to get the data from gmail attachments.
>
> Default Email app, is very dumb and is hardcoded to only open audio
> and image attachments.
> (disclaimer, that was the case 6 month ago, the last time i looked at
> it).
>
> On Jul 8, 10:16 am, Mirko Nasato  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:
>
> >   
> >      
> >      
> >      
> >   
>
> > The GMail app also tries to use my app to Preview attachments of 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 the Email app... there just doesn't seem any
> > way to make it open the attachments.
>
> > Any pointers? Opening attachments is 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Associate app to open email attachments

2009-07-14 Thread Mirko Nasato

On Jul 10, 7:13 pm, Alexey Krasnoriadtsev 
wrote:
> You are correct that you should use contentResolver.openInputStream
> (uri), to get the data from gmailattachments.
>
Thanks Alexey, will try that for integrating with the GMail app.

> Default Email app, 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).
>
That's still the case, looking at the 1.5r2 source:
com.android.email.Email uses a hard-coded array of
ACCEPTABLE_ATTACHMENT_VIEW_TYPES.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Associate app to open email attachments

2009-07-10 Thread Alexey Krasnoriadtsev

You are correct that you should use contentResolver.openInputStream
(uri), to get the data from gmail attachments.

Default Email app, is very dumb and is hardcoded to only open audio
and image attachments.
(disclaimer, that was the case 6 month ago, the last time i looked at
it).


On Jul 8, 10:16 am, Mirko Nasato  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:
>
>   
>      
>      
>      
>   
>
> The GMail app also tries to use my app to Preview attachments of 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 the Email app... there just doesn't seem any
> way to make it open the attachments.
>
> Any pointers? Opening attachments is 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---