android发送短信

1.在androidmanifest.xml中添加权限:
<uses-permission android:name="android.permission.SEND_SMS"/>


2.短信发送函数:
private void sendSMS(String phoneNumber, String message) {
    PendingIntent pi = PendingIntent.getActivity(this, 0,
    new Intent(this, TinySMS.class), 0);
    SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage(phoneNumber, null, message, pi, null);
}

你可能感兴趣的:(android发送短信)