public class sendThread extends Thread {
private String phone;
private String content;
public sendThread(String phone, String content) {
this.phone = phone;
this.content = content;
}
public void run() {
try {
String addr = "sms://" + phone;
//System.out.println("发送地址为:" + addr);
MessageConnection conn = (MessageConnection) Connector.open(addr);
TextMessage msg = (TextMessage) conn.newMessage(MessageConnection.
TEXT_MESSAGE);
msg.setPayloadText(content);
conn.send(msg);
conn.close();
} catch (Exception e) {
//System.out.println("Error in sending");
e.printStackTrace();
}
}
}
相关文章:
看完了要说点啥么?