import java.io.IOException;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.wireless.messaging.*;
public class Send extends MIDlet {
public void startApp() {
String smsPort = getAppProperty("SMS-Port");
String tel = "+33677777777";
MessageConnection sms_con=null;
try {
sms_con = (MessageConnection) Connector.open("sms://"+tel+":"+smsPort);
TextMessage sms=(TextMessage)sms_con.newMessage(MessageConnection.TEXT_MESSAGE);
sms.setAddress(tel+":"+smsPort);
sms.setPayloadText("j'envoie un texto");
sms_con.send(sms);
sms_con.close();
} catch (IOException ex) { ex.printStackTrace(); }
}
Partager