android SMS短信代码编写

//发送短信
EditText mobileText = (EditText)findViewById(R.id.mobile);

EditText contentText = (EditText)findViewById(R.id.content);

String mobile = mobileText.getText().toString();
String content = contentText.getText().toString();

SmsManager smsManager = SmsManager.getDefault();

ArrayList<String> texts = smsManager.divideMessage(content);//拆分短信,防止短信大于70个字符

for(String text : texts){

 smsManager.sendTextMessage(mobile, null, text, null, null);

}
Toast.makeText(MainActivity.this, R.string.success, Toast.LENGTH_LONG).show();
  

你可能感兴趣的:(android SMS短信代码编写)