2011-06-10 111 views
0

我是android新手。在我的應用程序中,我想用聯繫人發送短信。如何通過我的應用程序向其他人發送短信如何向聯繫人發送短信?

+0

下面是一個示例:http://tinyurl.com/5rluxet – mdm 2011-06-10 09:50:15

回答

1

private String SENT = "SENT"; 
private String DELIVERED = "DELIVERED"; 
... 
PendingIntent sentPI = PendingIntent.getBroadcast(this.context, this.getUniqueId(), new Intent(this.SENT), 0); 
PendingIntent deliveredPI = PendingIntent.getBroadcast(this.context, this.getUniqueId(), new Intent(this.DELIVERED), 0); 

String smsNumber = "+123456"; 

SmsManager sms = SmsManager.getDefault(); 
sms.sendTextMessage(smsNumber, null, "sms content", this.sentPI, this.deliveredPI);