如何发送短信与联系人?

时间:2011-06-10 09:48:38

标签: android

我是android新手。在我的应用程序中,我想发送短信与联系人。如何通过我的appplication将短信发送给其他人

1 个答案:

答案 0 :(得分: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);