I have being tryn to send and recieve sms from j2me emulator. I cameup with following code inorder to send the sms

String mno=toWhom.getString(); // mno= massage number
                  String msg=message.getString();


                        try {
                              clientConn=(MessageConnection)Connector.open("sms://"+mno); //MessageConnection clientConn;
                        }
                        catch(Exception e) {
                              alert = new Alert("Alert");
                              alert.setString("Unable to connect to Station because of network problem");
                              alert.setTimeout(2000);
                              display.setCurrent(alert);
                        }
                        try {
                              TextMessage textmessage = (TextMessage) clientConn.newMessage(MessageConnection.TEXT_MESSAGE);
                              textmessage.setAddress("sms://"+mno);
                              textmessage.setPayloadText(msg);
                              clientConn.send(textmessage);
                              System.out.println("text msg sent");
                        }
                        catch(Exception e)
                        {
                              Alert alert=new Alert("Alert","",null,AlertType.INFO);
                              alert.setTimeout(Alert.FOREVER);
                              alert.setString("Unable to send");
                              display.setCurrent(alert);
                        }

This just executes without any error.

But i have no idea on how to recieve the massage send or where this massage is sent internally or how to manage it. please help me with this. I use WTK 2.5.2 & wireless massaging API 2.0

Recommended Answers

All 3 Replies

Hello,
If u want to see whether your msg is sent or received in emulator, that you can check with help of Network Monitor. For this, just see the Preference of WTK. Hope this will help you.

I can't figure how to work with the monitor. It just appears when the emulator run. But nothing on displays. Is that mean that the sms app is not working?

Ok, when your Network Monitor starts, you can see tabs in that like HTTP/HTTPS, SMS/CBS, MMS .....etc. So when you open SMS/CBS tab, u can see the message.

Here I am giving you link that describes WTK's user guide, have a detail study for that.
http://download.oracle.com/javame/dev-tools/wtk-cldc-2.5.2-01/UserGuide-html/index.html

and next time put screen shot. Actually, you are working on emulator, so on which ever number you'll send message, it will go. Just for confirmation you can try on real device.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.