Results 1 to 4 of 4
  1. #1
    hewstone is offline Member
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    0

    Default Midlet to receive sms message

    Hello,
    I am trying to develop an application (midlet) in Java which receives an sms message and processes it. Please could someone explain the main steps and links to resources e.g. creating a GUI, code, receiving the text message etc.

    Thanks in advence for your help

    Rich

  2. #2
    mrafraid2009 is offline Member
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    0

    Thumbs up

    i can give you what you want but give me a cost!!

    hehehe

    God Bless!!!

  3. #3
    jason.3dmagic is offline Member
    Join Date
    Oct 2009
    Posts
    30
    Rep Power
    0

    Arrow

    Try and find google you will get codes
    I Just googled for it
    add database connectivity and its done


    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.wireless.messaging.*;
    import javax.microedition.io.*;

    public class PushDemo extends MIDlet implements CommandListener
    {
    private Display display;
    private Command cmExit;
    private Alert alertIncomingMessage;
    int incomingPortNum=6535;
    MessageConnection incomingConnection = null;
    Message incomingMessage;


    public PushDemo ()
    {
    display = Display.getDisplay(this);
    alertIncomingMessage = new Alert("Incoming Message");
    alertIncomingMessage.setTimeout(Alert.FOREVER);

    cmExit = new Command("Exit", Command.EXIT, 1);
    alertIncomingMessage.addCommand(cmExit);
    alertIncomingMessage.setCommandListener(this);
    }

    public void startApp()
    {
    String connectList[];
    connectList = PushRegistry.listConnections(true);
    if (connectList == null || connectList.length == 0) {
    //Started by the user,exit
    destroyApp(false);
    notifyDestroyed();
    }
    else { //started from incoming connection...
    try {
    incomingConnection = (MessageConnection) Connector.open("sms://:" +
    incomingPortNum);
    // Recieve the message
    incomingMessage = incomingConnection.receive();

    //If it's a text message add it to the alert
    if (incomingMessage != null && incomingMessage instanceof TextMessage) {
    alertIncomingMessage.setTitle("From: " + incomingMessage.getAddress());
    alertIncomingMessage.setString( ( (TextMessage) incomingMessage).
    getPayloadText());
    //Display the message
    display.setCurrent(alertIncomingMessage);
    }
    }
    catch (Exception e)
    {
    System.out.println("IO Exception!");
    }
    }
    }

    public void pauseApp()
    {
    System.out.println("The pauseApp method is invoked");
    }

    public void destroyApp(boolean cond)
    {
    System.out.println("The destroyApp method is invoked");
    }

    /**Handle command events*/
    public void commandAction(Command command, Displayable displayable) {
    /** @todo Add command handling code */
    if (command.getCommandType() == Command.EXIT) {
    // stop the MIDlet
    destroyApp(true);
    }
    }
    }


    Regards...

  4. #4
    Laksh is offline Member
    Join Date
    Nov 2011
    Posts
    1
    Rep Power
    0

    Default Re: Midlet to receive sms message

    I am getting exception for the above code. I have googled but I am nt getting correct code to run in java midlet. can any one pls provide me code for both and send and receive. I have sending SMS without port no. bt if as google info we cant receive message without port no. Kindly suggest and provide me the details. it will be more helpfull

Similar Threads

  1. sms midlet
    By Poonam in forum CLDC and MIDP
    Replies: 3
    Last Post: 11-25-2009, 03:47 PM
  2. Replies: 1
    Last Post: 01-28-2008, 11:49 AM
  3. PC receive data via Bluetooth using JAVA
    By toncoolx in forum New To Java
    Replies: 0
    Last Post: 11-27-2007, 05:50 AM
  4. Servlet that receive n parameters
    By Felissa in forum Java Servlet
    Replies: 1
    Last Post: 06-07-2007, 08:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •