1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| public void envioSMS() {
String numero = portable.getString();
String destinataire = "sms://+33" + numero;
MessageConnection con = null;
try {
con = (MessageConnection)Connector.open();
TextMessage mensaje = (TextMessage)con.newMessage(MessageConnection.TEXT_MESSAGE );
mensaje.setAddress( destinataire );
mensaje.setPayloadText( "Test de SMS");
con.send( mensaje );
Alert msg = new Alert( "Envoi SMS"," Message envoyez",null,AlertType.INFO);
display.setCurrent( ,screen );
} catch( Exception e ) {
display.setCurrent(screen);
return;
}
if( con != null ) {
try {
con.close();
} catch( IOException ie ) {
} finally {
display.setCurrent(screen);
return;
}
} else {
display.setCurrent(screen);
return;
}
} |