1.拨打电话,拨号

//拨打电话
Intent intent = new Intent(); intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:"+phoneNumber)); startActivity(intent);
//拨号
Intent intent = new Intent(); intent.setAction(intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + phoneNumber)); startActivity(intent);

注意:"tel:"一定要小写!

   需要配置android.permission.CALL_PHONE权限

2.发短信

android.telephony.SmsManager smsManager =android.telephony.SmsManager.getDefault();
//divide message into several messages.
ArrayList<String> ary_sms = smsManager.divideMessage(str_content);
for (String smss : ary_sms) {
  smsManager.sendTextMessage(str_phone, null, smss, null, null);
}                
Toast.makeText(getApplicationContext(), R.string.msg_sendfinish, Toast.LENGTH_LONG).show();

注意:需要配置android.permission.SEND_SMS权限

相关文章:

  • 2021-08-17
  • 2021-12-31
  • 2021-12-17
  • 2022-12-23
  • 2021-08-14
  • 2021-07-15
  • 2021-12-16
  • 2022-02-20
猜你喜欢
  • 2021-12-31
  • 2021-05-27
  • 2022-12-23
  • 2022-01-16
  • 2021-12-17
  • 2021-11-07
  • 2022-12-23
相关资源
相似解决方案