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权限