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发送短信
最新推荐文章于 2021-05-25 21:47:04 发布