Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
akirekadu
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified
Accepted Solution

Programatically launching the default email editor

Is there a way to launch the default email editor programtically?  I haven't been able to find a class that supports such operation.  I have been thinking about launching the browser with a 'mailto'  URL, but that is more of a hack.  I am thinking there much be a better way to do this.  Anybody ideas?  Thanks!

Please use plain text.
Developer
richard_puckett
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: Programatically launching the default email editor

Is this what you're looking for?

 

 

Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(MessageArguments.ARG_NEW, "bob@foo.com", "", ""));

 

 

 

Please use plain text.
Developer
akirekadu
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified

Re: Programatically launching the default email editor

Thanks Richard!  Yes this is what exactly I was looking for.  Well, almost.  I also need to add an attachment to the new email.  Doesn't seem like MessageArguments  supports that.  Is it possible at all?                                                                                                                                          
Please use plain text.
Developer
richard_puckett
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: Programatically launching the default email editor

AFAIK, we can't specify an attachment when launching the mail client with Invoke.

 

The only alternative I can think of is to create your own email interface; collect whatever info you need from the user, and then send the message w/ attachment using Transport.  That's a little more involved than simply launching the native email client though.  :smileyhappy:

Please use plain text.
Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Programatically launching the default email editor

[ Edited ]

You can call Invoke.invokeApplication() by sending it new MessageArguments(Message).

Your attachment will go in the SupportedAttachmentPart.

 

Message message = new Message();
Multipart multipart = new Multipart();

multipart.addBodyPart( new TextBodyPart( multipart, "This is the body." ) );
multipart.addBodyPart( new SupportedAttachmentPart( multipart, mime, filename, buffer ) );

 

message.setSubject( "This is the subject." );
message.setContent( multipart );

Invoke.invokeApplication( Invoke.APP_TYPE_MESSAGES, new MessageArguments( message ) );

The mime type will be a combination of ContentType.TYPE_ + ContentType.SUBTYPE_.

 

The filename is whatever you want the attachment name to be.

Message Edited by mreed on 07-17-2008 11:28 PM
Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Programatically launching the default email editor

Here is a link to one of our samples that creates and sends a message with an attachment.

 

How To - Create an attachment
Article Number: DB-00009
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800698/How_To_...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
akirekadu
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified

Re: Programatically launching the default email editor

[ Edited ]

Sweeeeet!

 

Thanks very much, Martin and Mark...

Message Edited by akirekadu on 07-21-2008 12:25 AM
Please use plain text.
Developer
ravindrakamble
Posts: 68
Registered: ‎07-21-2008
My Device: Not Specified

Re: Programatically launching the default email editor

Thank you very much. It really helpful to me...
Please use plain text.
New Developer
Posts: 2
Registered: ‎07-29-2008
My Device: 8900

Re: Programatically launching the default email editor

Hello Mark,

 

what is the maximum size of an attachment? We get a ""Failed to contact service" error if we attach more than 4K even if we split them into multiple attachments having each less than 4K.

 

Tested with 8310/4.5.0.69, 8900/4.6.1.76 and 9000/4.6.0.167. Devices are connected to BIS 2.4.

 

Harold Strohmaier

COSYNUS GmbH

Harold Strohmaier
COSYNUS GmbH
Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Programatically launching the default email editor

I haven't been able to reproduce this.  I tested with a 70k file.  The limit should be in the megabytes range.  Are you able to attach large files and send them using the built in Messages application?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.