SMSDemo Application

Java™ 2 Platform, Micro Edition, Wireless Toolkit
Version 2.1

December  2003

 

The SMS Demo

The SMSDemo application is an example MIDlet suite that demonstrates SMS and CBS features. You can use the source code of the demo as an example for your own messaging applications. The application also uses push functionality if run in OTA Provisioning mode. Push registration entries are included in the demo's MIDlet attributes. You can view the Project Settings dialog box for example values.

Running the SMS Demo Application

You can use the SMS demo application as a tutorial for using the WMA console to send and receive SMS messages. This walk through demonstrates messaging output in the WMA console and the emulated device. The demo uses the MIDP 2.0 push feature to register itself to be awoken automatically when the device receives a message. You must run the application with OTA Provisioning if you want to use the push features of the demo.

To run the SMSDemo application, follow these steps:

  1. Click the Open Project button in the KToolBar and choose the SMSDemo project.
  2. Choose Project -> Run via OTA

    The SMSDemo application is best experienced when run in OTA provisioning mode (the push registries are created for you). The default emulated device opens with the AMS splash screen displayed.

  3. Click Apps on the device to leave the splash screen.
  4. Install the SMS Demo application.

    The initial installation of the SMS Demo is a multi-task step:

    1. Click Menu and select Launch.

      A URL address for the demo is provided for you to install from:


      Fig 1. SMSDemo URL

    2. Click Menu and select Go.
    3. Click Install to install the highlighted SMSDemo.jad file.
    4. Click Install to confirm you want install the demo application.
    5. Click Select and then OK to agree to periodic start-up.
    6. Click Select and then OK to send SMS information.
    7. Click Select and then OK to receive CBS information.
    8. Installation of the SMSDemo application is now complete.

  5. Select Launch from the Menu to run the demo application.
  6. Open the WMA console by choosing File -> Utilities and click Open Console for the WMA in the Utilities window.

    The WMA console window opens displaying its phone number.

  7. Click Launch in the emulated device to run the SMS Send MIDlet:


    Fig 2. SMS and CBS Demo Programs
  8. Type the phone number for the WMA console for the destination address and click OK.

    The number is displayed in the console's output window. You can enter the number from the keyboard or by using the keypad on the emulated device. Type the phone number as one continuous string. The device will automatically place a space in the phone number.

  9. Type the message, "Hello" and click Send:


    Fig 3. Hello Message Received

  10. The Hello message appears in the WMA console window along with the SMS address of the sender and the port number on which the message was received.

  11. Use the WMA console to reply to the message by clicking on Send SMS in the WMA console.
  12. Select the client address for the device, type the client's port number in the Port field (the SMSDemo application uses port 50000 for SMS messages), and type the message, "How are you?" and click Send:


    Fig 4. Send a Message Dialog Box Showing Reply To Send

  13. The message, "How are you?", appears in the device's display screen:


    Fig 5. Device Display Screen Showing Reply

    The device also shows the address of the sender.

    The device used the push functionality and launched the SMSReceive MIDlet in response to receiving an SMS communication on the URL registered to this MIDlet: sms://:50000.

  14. Click Reply on the device and type the reply, "Fine, thank you." and click Send.

    Output on the device screen states that a message is being sent. The WMA console displays the message it received:


    Fig 6. WMA Console Showing New Message

Sending a CBS Message

You can run the SMSDemo again, this time to send a CBS message:

  1. Launch another emulated device using OTA Provisioning and install the SMSDemo application as described in steps 2 through 4.
  2. Use the WMA Console to broadcast a CBS message to all devices. The steps are similar to sending an SMS message from the WMA Console (step 11) but no destination phone number is selected, and the Message Identifier is 50001. This is the Message Identifier that the SMSDemo uses.

    Both emulated devices receive the bradcasted message and the push functionality launches the CBSReceive MIDlet to display the message. The WMA Console also displays the received message.