Troubleshooting guide

136
BlackBerry Java Development Environment Development Guide
Add a new event source
Register the event source when the BlackBerry device starts
To register the event source when the BlackBerry® device starts, create a separate project that acts as an
alternative entry point to the main application. When the BlackBerry device starts, this project automatically runs
as a system module and passes an argument to the application, allowing the application to perform any one-time
initializations.
Task Steps
Create a unique long ID. 1. Define a long ID for each notification event.
public static final long ID_1 = 0xdc5bf2f81374095L;
2. Open the BlackBerry® Integrated Development Environment.
3. In the BlackBerry IDE text pane, type a string.
4. Select the string.
5. Right-click the highlighted string.
6. Click Convert “string” to Long.
Define a source object. 1. Define an object that provides the source for the event.
Object event = new Object() {
2. Your implementation of toString() returns the string to display in the profiles list.
public String toString() {
return "Notification Demo";
}
}
Add the application to the
BlackBerry device profiles.
1. Invoke NotificationsManager.registerSource().
2. In this method, specify a unique event ID, the source object, and, for deferred events only, one of the
following priority levels:
NotificationsConstants.CRITICAL
NotificationsConstants.SENSITIVE
NotificationsConstants.IMPORTANT
NotificationsConstants.DEFAULT_LEVEL
NotificationsConstants.CASUAL
Task Steps
Create an initialization project. 1. In the BlackBerry Integrated Development Environment, create a project.
2. Right-click the project, and then click Properties.
3. On the Application tab, in the Project type drop-down list, click Alternate CLDC Application
Entry Point.
4. In the Alternate entry point drop-down list, click the event source project.
5. In the Arguments passed to field, type autostartup.
6. Select the Auto-run on startup option.
7. Select the System module option.
8. Click OK.