Post this topic to send SMS
public class SendSMS extends Thread { private String receiver; private String receivedMsg; private HomeScreen home; private boolean bool = false; private boolean notsent; public SendSMS(HomeScreen gen, String msg, String number) { this.home = gen; this.receiver = number; this.receivedMsg = msg; } public void run() { while (!bool) { SendMessage(); } } private void SendMessage() { String s = "sms://" + receiver; send(s); } private void send(String url) { MessageConnection messageconnection = null; try { messageconnection = (MessageConnection) Connector.open(url); TextMessage textmessage = (TextMessage) messageconnection.newMessage(MessageConnection.TEXT_MESSAGE); textmessage.setAddress(url); textmessage.setPayloadText(receivedMsg); messageconnection.send(textmessage); } catch (Exception throwable) { notsent = true; home.genericObject.setSmsStatus(false); if (!home.isNokia()) { new PopUp("Message not sent");
Nokia devices do not display a system alert if a message is sent from j2me. Therefore, if you want to show a warning, you need to create your own PopUp and show.
source share