BlackBerry Device Applications Integration Guide
Task
Retrieve information about the
attachment.
Send a message with an attachment
Task
Create a multipart message.
Create each component of the
attachment.
Add each SupportedAttachmentPart
object to the multipart object.
Set the content of the attachment.
Send the message.
26
Steps
>
Invoke the methods of the
SupportedAttachmentPart
the BlackBerry® device. An
does not have a viewer on the BlackBerry device.
Steps
>
Multipart
Create a new
byte[] data = new byte[256]; // The attachment.
MultiPart multipart = new MultiPart(); // Default type of multipart/mixed.
SupportedAttachmentPart
>
Create a
parent.
SupportedAttachmentPart attach = new SupportedAttachmentPart( multipart,
"application/x-example", "filename", data);
addBodyPart(SupportedAttachmentPart)
>
Invoke
multipart.addBodyPart(attach); // Add the attachment to the multipart.
setContent(Multipart)
>
Invoke
Multipart
object.
msg.setContent(multipart);
Session.getTransport()
1. Invoke
Transport
Transport
. The
Transport trans = Session.getTransport();
trans.send(Message).
2. Invoke
try {
trans.send(msg);
} catch(MessagingException e) {
System.out.println(e.getMessage());
}
SupportedAttachmentPart
class represents an attachment with a corresponding viewer on
UnsupportedAttachmentPart
object.
object, designating the
Message
on the
object and provide as a parameter the
and store the returned object in a variable of type
object represents the messaging transport protocol.
class. The
represents an attachment that
Multipart
object as its
object.
on that