注意:短信管理器的获取,长短信的拆分
//点击发送按钮后发送用户输入的内容 //1、获取用户输入的内容 EditText et_phone = (EditText) findViewById(R.id.et_phone); EditText et_content = (EditText) findViewById(R.id.et_content); String phone = et_phone.getText().toString(); String ms = et_content.getText().toString(); //拿到发送短信的api SmsManager sm = SmsManager.getDefault(); ArrayList<String> mss = sm.divideMessage(ms); for(String msg : mss){ sm.sendTextMessage(phone, null, msg, null, null); }
时间: 2024-11-10 13:40:04