|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AttachmentHandler
Defines functionality one must implement to perform custom attachment actions.
You can implement this interface to create an attachment handler for custom attachments that applications on the BlackBerry device can use.
When an attachment is created, two bits of information are associated
with it: an attachment type and a file name. When the attachment is processed through a
BlackBerry Enterprise Server, the content type is truncated. For example, the content type
application/x-rimdevice-MySpecialContent
is truncated to application/
.
The file name of the attachment is then appended to produce application/MyFileName.ext
.
To accommodate this behaviour, creators of attachments should provide
them with filenames that encapsulate the content type. For example,
x-rimdevice-MySpecialContent-MyFileName.ext
.
Each attachment handler must be able to declare (through the
AttachmentHandler.supports(java.lang.String)
method) which content types it supports. It is important to
be as precise as possible when declaring which types can be supported. Your
implementation should not simply return true for all x-rimdevice
content, but rather the specific content types you can handle. With the
previous examples in mind, your method might return true only when tested
against the x-rimdevice-MySpecialContent
type or the
x-rimdevice-MySpecialContent-MyFileName.txt
type.
To alert the system that your handler is available for use, it must register
using
AttachmentHandlerManager.addAttachmentHandler
.
Because of the way the system processes incoming messages, your handler will
only be eligible to handle content that arrives after you register
the handler.
Method Summary | ||
---|---|---|
|
String |
menuString()
Defines the menu item to display for this attachment handler. |
|
void |
run(Message m,
SupportedAttachmentPart p)
Performs custom processing on an attachment. |
|
boolean |
supports(String contentType)
Determines whether this attachment handler accepts a specific content type. |
Method Detail |
---|
boolean supports(String contentType)
This method is invoked when the BlackBerry device receives an attachment. Implement this method to return true only when tested against the particular content type this handler accepts.
contentType
- MIME content type.
String menuString()
This method is invoked when the user selects an attachment in the Messages screen. Implement this method to return the menu item string to present in the Messages screen when the user selects a supported attachment.
void run(Message m, SupportedAttachmentPart p)
The system invokes this method when the user selects the corresponding menu item in the Messages screen.
Note: The system invokes this method on the event thread of the Messages application.
m
- Message that contains the attachment.p
- Attachment for this attachment handler to process.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal