【Android】项目:短信发送
- 权限设置:
1
<uses-permission android:name="android.permission.SEND_SMS" />
- 发送短信代码:
1
2
3
Intent intent = new Intent();
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(number, null, content, null, null);
- Android短信内容长度限制为75个汉字,如果超过长度则拆分,分段发送:
1
2
3
ArrayList<String> contents = smsManager.divideMessage(content);
for (String str : contents)
smsManager.sendTextMessage(number, null, str, null, null);
This post is licensed under CC BY 4.0 by the author.