Application Trigger Tutorial
The first step to creating an Application Trigger is to set up the MIDlet so it will be registered successfully with the Push Registry
To create a MIDlet that uses the Push Registry you will need to download the most up to date version Java 2 Platform, Standard Edition (J2SE) and the Java Wireless Toolkit or Netbeans along with the mobility pack.
The first step is to define the attributes for the Push Registry:
1. Start by creating a new project using the Wireless Toolkit.
2. Click settings, this will present you with a new window with a menu on the left hand side.
3. Under API section select the Target Platform as JTWI.
4. Select the User Defined section. This allows you to define the properties of your application that can later be used in your development. This allows you to define your SMS port number within the properties of the application rather than having to hard code it, and then retreive the SMS port using the method below. This means to change the port you only have to change it in one place, allowing easy maintenance.
This code shows how the SMS port can be retrieved from the applications properties.
public SMSReceive() {
smsPort = getAppProperty("SMS-Port");
//...
}
5. Within the MIDlet section it is necessary to define the details about the MIDlet you are creating i.e. the Name, any Icon you want for it, and where the class is found.
If you are not defining any packages then the class is just the name of your file. When you created the new project these details where filled in so edit them as necessary.
6. In the Push Registry section you need to define all the MIDlet attributes. Click the add button to add a new entry. In the connection box you need to define the connection type and the port your want registered for the MIDlet. This should be the same as the port you defined in the User defined section. For example if you want the MIDlet to be activated by an SMS message on port 6666 enter sms://:6666 as the connection URL. The class is just the name of the application you want to be triggered by an SMS message and any packages you have defined it in. The allowed sender box is used to define who is allowed to trigger the application, to allow SMS messages from anyone just enter * in the box. To restrict who can trigger you application via an SMS message specify a URL in the allowed sender box and then messages just from this URL will be able to trigger the application.
7. It is now necessary to set the permissions for the MIDlet. Select the permissions by selecting the permissions icon and add the following using the tree structure
javax/microedition/io/Connector/sms
javax/wireless/messaging/sms/receive
javax/microedition/io/PushRegistry
8. Once your application is created and transfered to a mobile device it will be registered on port 6666.
9. Now the Push Registry details are set up it is time to create your application. This Application Trigger function offers its self to a number of exciting applications.
The first step is to define the attributes for the Push Registry:
1. Start by creating a new project using Netbeans- Select file, New Project, Mobility, Mobile Application.
2. Click settings, this will present you with a new window with a menu on the left hand side.
3. Under the Platform section select the Target Platform as CLDC/MIDP.
4. Select the Application Descriptor section. This section allows you to define the properties of your application that can later be used in your development. For example you can define your SMS port to be used in this section and then within your code request the port number.
This code shows how the SMS port can be retrieved from the applications properties.
public SMSReceive() {
smsPort = getAppProperty("SMS-Port");
//...
}
5. Within the MIDlets section it is necessary to define the details about the MIDlet you are creating i.e. the Name, any Icon you want for it, and where the class is found.
If you are not defining any packages then the class is just the name of your file. When you created the new project these details where filled in so edit them as necessary.
6. In the Push Registry section you need to define all the MIDlet attributes. Click the add button to add a new entry. In the connection box you need to define the connection type and the port your want registered for the MIDlet. This should be the same as the port you defined in the User defined section. For example if you want the MIDlet to be activated by an SMS message on port 6666 enter sms://:6666 as the connection URL. The class is just the name of the application you want to be triggered by an SMS message and any packages you have defined it in. The allowed sender box is used to define who is allowed to trigger the application, to allow SMS messages from anyone just enter * in the box. To restrict who can trigger you application via an SMS message specify a URL in the allowed sender box and then messages just from this URL will be able to trigger the application.
7. It is now necessary to set the permissions for the MIDlet. Select the API permissions tab then add the following permissions by clicking the add button and then entering the following.
javax.microedition.io.Connector.sms
javax.wireless.messaging.sms.receive
javax.microedition.io.PushRegistry
After further development it may be necessary to add more permissions, these defined permissions just allow the application trigger mechanism to work.
8. Once your application is created and transfered to a mobile device it will be registered on port 6666.
9. Now the Push Registry details are set up it is time to create your application. This Application Trigger function offers its self to a number of exciting applications.