• Exercise

    Write an application that registers a custom notification and a folder listener. The folder listener will activate the custom notification when an email arrives with a particular string in the subject of the email.

    Objectives

    • Discover how to make an application auto-start
    • Discover how to register a folder listener
    • Discover how to register a custom notification
    • Discover how to monitor incoming email

    Setup

    1. Download the file (ZIP)
    2. In the IDE, open the FolderListenerApp.jdw workspace
    3. Open the MessageNotification.java source file.
    4. Open the FolderListenerApp.java source file.

    Tasks

    1. FolderListener Changes:
      1. Register the custom notification with the system
      2. Add a FolderListener to the store after it is retrieved
      3. Determine if the incoming message has been added to the INBOX folder
      4. Retrieve the subject of the new message
      5. Trigger the notification once it is discovered that the subject contains the string “< TAG >”.
    2. MessageNotification Changes:
      1. Register the consequence manager

    Check Your Work

    Download the completed code (ZIP)

    Review

    In this exercise, you discovered the following things:

    • to make an application auto-start
    • to register a folder listener and a custom notification
    • to monitor incoming email

    Additional Labs

    Go to the first exercise in "Working with Multiple Processes and Threads", Listening for Pushed Data

    Back to the Developer Lab Main Menu