Results 1 to 4 of 4
Thread: sms midlet
- 02-12-2008, 10:45 AM #1
Member
- Join Date
- Nov 2007
- Posts
- 15
- Rep Power
- 0
- 03-06-2008, 01:48 PM #2
Member
- Join Date
- Mar 2008
- Posts
- 5
- Rep Power
- 0
Hi Poonam,
You can send a text message with the following codes
MessageConnection conn =(MessageConnection) Connector.open("sms://5550001:1234");
TextMessage txtmessage = (TextMessage) conn.newMessage(
MessageConnection.TEXT_MESSAGE);
txtmessage.setPayloadText(msgString);
conn.send(txtmessage);
You can receive the message in two different ways:
1) Blocking the call
2) unblocking the call
First way:
conn = (MessageConnection) Connector.open("sms://5550001:1234");
msg = conn.receive(); // Blocking here
mSenderAddress = msg.getAddress(); // Get info from message
if (msg instanceof TextMessage) {
String msgReceived = ((TextMessage)msg).getPayloadText();
// Do something with the message here
} else if (msg instanceof BinaryMessage) {
byte [] msgReceived = ((BinaryMessage)msg).getPlayloadData();
// do something with the binary message here
}
}
Second Way:
For second way, register to the Interface like MessageListener
Regards,
sk_shadul
- 11-25-2009, 02:23 PM #3
Member
- Join Date
- Nov 2009
- Posts
- 3
- Rep Power
- 0
can we receiving SMS from java midlet without a specific port??
- 11-25-2009, 02:47 PM #4
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
Similar Threads
-
Using Alert in MIDlet
By Java Tip in forum Java TipReplies: 0Last Post: 11-22-2007, 10:22 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks