Bom dia Pessoal,
Primeiramente muito obrigado pelas as respostas, foi de ótima valia as dicas enviadas. O meu orientador conseguiu dois códigos, um para o destinatário ou seja, para o número do celular e o outro para enviar a mensagem propriamente dita, ou seja, o texto. Como a mensagem precisa ser algo rápido, gostaria de saber se tem como colocar uma mensagem programada, por exemplo:
Nome: xxxxxxxxxxx
Endereço: aaaaaaaaaa
Bairro: ddddddd
Cidade: eeeee
Tel: 999999
Cel: 9999
Verifico esses dados no visor e clico em ok para enviar a mesma. Abaixo segue o código:
import java.io.IOException;
import javax.microedition.io.;
import javax.microedition.lcdui.;
import javax.wireless.messaging.*;
/**
-
Prompts for text and sends it via an SMS MessageConnection
/
public class SMSSender implements CommandListener, Runnable {
/* user interface command for indicating Send request */
Command sendCommand = new Command(“Send”, Command.OK, 1);
/** user interface command for going back to the previous screen */
Command backCommand = new Command(“Back”, Command.BACK, 2);
/** Display to use. */
Display display;
/** The port on which we send SMS messages */
String smsPort;
/** The URL to send the message to */
String destinationAddress;
/** Area where the user enters a message to send */
TextBox messageBox;
/** Where to return if the user hits “Back” */
Displayable backScreen;
/** Displayed when a message is being sent */
Displayable sendingScreen;
//private TextBox String;
/**
/**
- Prompt for message and send it
*/
public void promptAndSend(String destinationAddress) {
this.destinationAddress = destinationAddress;
display.setCurrent(messageBox);
}
/**
- Respond to commands, including exit
-
@param c user interface command requested
-
@param s screen object initiating the request
*/
public void commandAction(Command c, Displayable s) {
try {
if (c == backCommand) {
display.setCurrent(backScreen);
} else if (c == sendCommand) {
display.setCurrent(sendingScreen);
new Thread(this).start();
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
/**
Desde já agradeço a todos,
Muito obrigado,
Elcio