Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Sending Receiving from MIDlets

  1. #1
    Jhovarie is offline Banned
    Join Date
    Feb 2011
    Posts
    65
    Rep Power
    0

    Default Sending Receiving from MIDlets

    Hello guys im beginner in j2me an i want to use this code but i cant do it.

    it just a snipnet code

    Java Code:
    // Lets send an SMS now.
    //get a reference to the appropriate Connection object using an appropriate url
    MessageConnection conn = (MessageConnection) Connector.open("sms://:50001");
    //generate a new text message
    TextMessage tmsg = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
    //set the message text and the address
    tmsg.setPayloadText(message);
    tmsg.setAddress("sms://" + number);
    //finally send our message
    conn.send();
    and this one

    Java Code:
    // Time to receive one.
    //get reference to MessageConnection object
    MessageConnection conn = (MessageConnection) Connector.open("sms://:50001");
    //set message listener
    conn.setMessageListener(
       new MessageListener() {
          public void notifyIncomingMessage(MessageConnection conn) {
             Message msg = conn.receive();
             //do whatever you want with the message
             if(msg instanceof TextMessage) {
                TextMessage tmsg = (TextMessage) msg;
                System.out.println(tmsg.getPayloadText());
             } else if(msg instanceof BinaryMessage) {
                .....
             } else {
                ......
             }
          }
       }
    );
    this codes is originaly from Sending/Receiving SMS from MIDlets [java] [sms] [j2me] [wmapi] [cldc]

    please give me the full code of that two sample thanks..

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,300
    Rep Power
    20

Similar Threads

  1. Sending and receiving xml files using struts
    By delarge08 in forum Web Frameworks
    Replies: 0
    Last Post: 04-05-2011, 12:57 AM
  2. Using database in midlets
    By powerohit@gmail.com in forum CLDC and MIDP
    Replies: 1
    Last Post: 12-22-2010, 02:36 PM
  3. Byte Array sending and receiving using Socket
    By venkateshcoolmoon in forum Networking
    Replies: 3
    Last Post: 01-23-2010, 07:34 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
  •