The following procedure creates a MIDlet that automatically runs when the BlackBerry smartphone starts.
Make sure the Java Application Descriptor (JAD) file for your application has been added to your project.
Verify that the following property exists in your JAD file:
Set this property to a value of 1.
Build the project.
Setting RIM-MIDlet-Flags-1 to a value of 1 will trigger your application to start automatically when the BlackBerry smartphone starts; then the application will perform its required actions. Alternatively, an application can be set to auto-register with the PushRegistry on startup. This allows an application to accept incoming network connections, such as Hypertext Transfer Protocol (HTTP) and Short Message Service (SMS). When using the PushRegistry, the application is invoked whenever data arrives on the registered connection. For more information, see this article.