-3
我正在开发一个移动应用程序,我需要能够访问在J2ME或LWUIT默认的短信服务,我只是说我要发送的消息,我怎样才能把我的消息默认送我的手机的消息应用,并让用户选择联系人,然后重新发送消息并给我的应用程序发送短信在J2ME
请我需要紧急帮助
我正在开发一个移动应用程序,我需要能够访问在J2ME或LWUIT默认的短信服务,我只是说我要发送的消息,我怎样才能把我的消息默认送我的手机的消息应用,并让用户选择联系人,然后重新发送消息并给我的应用程序发送短信在J2ME
请我需要紧急帮助
检查下面的代码:
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();
}
}
/**
* Send the mesage using WMA api.
*/
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"); // not sent
}
bool = true;
try {
messageconnection.close();
} catch (Exception e) {
}
}
if (messageconnection != null) {
try {
messageconnection.close();
if (!notsent) {
home.genericObject.setSmsStatus(false);
if (!home.isNokia()) {
new PopUp("Message Sent"); // sent
}
}
bool = true;
} catch (Exception ie) {
ie.printStackTrace();
}
}
}
无想法为什么这被投票了,它甚至不完整。 – funkybro