Help Center
Local Navigation
- Integrating with BlackBerry Device Software applications
- Unified search
- Device interaction support
-
Message list
- Create a new blank SMS text message
- Create a new populated text message
- Create a new blank MMS message
- Create a new blank email message
- Create a new populated email message
- Create a new blank PIN message
- Create a new populated PIN message
- Receive a message notification
- Add a listener to the message store
- Add a listener to the message store for batch updates
- Add a listener to a folder
- Retrieve the total count of unread email messages in all folders in the store
- Open a message
- Retrieving the body of an email message
- Notify a BlackBerry device application that an email message is about to be sent
- Notify a BlackBerry device application that an MMS message is about to be sent
- Notify a BlackBerry device application that an SMS message is about to be sent
- Send a message
- Reply to a message
- Forward a message
- Work with message folders
- Custom messages
- Attachments
- Calendar
- Contact list
- Task list
- Phone
- BlackBerry Browser
- Menu items
- Find more information
- Glossary
- Provide feedback
- Document revision history
- Legal notice
BlackBerry Manuals & Help
>
Developer Documentation
>
Java Development Guides and API Reference
>
Development Guide
Integration - BlackBerry Java SDK - 6.0
Add a listener to the message store
- Import the required classes and interfaces.
import net.rim.blackberry.api.mail.NoSuchServiceException; import net.rim.blackberry.api.mail.Session; import net.rim.blackberry.api.mail.Store;
- Create a try-catch block to manage a NoSuchServiceException.
try { } catch (NoSuchServiceException e) { System.out.println(e.toString()); } - Within the try-catch block, invoke Session.waitForDefaultSession().getStore() to retrieve the Store object.
try { Store store = Session.waitForDefaultSession().getStore(); } catch (NoSuchServiceException e) { System.out.println(e.toString()); } - After the try-catch block, invoke store.addStoreListener() to add a StoreListener instance to the Store object.
store.addStoreListener(this);
Previous topic: Receive a message notification