- //发短信
- class SendMsgClickListener implements OnClickListener {
- public void onClick(View v) {
- //调用Android系统API发送短信
- Uri uri = Uri.parse("smsto:10086");
- Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
- intent.putExtra("sms_body", "android...");
- startActivity(intent);
- }
- }
- //打电话
- class SendCallClickListener implements OnClickListener {iphone5
- public void onClick(View v) {
- //调用Android系统API打电话
- Uri uri = Uri.parse("tel:10086");
- Intent intent = new Intent(Intent.ACTION_CALL, uri);
- startActivity(intent);
- }
- }
授权:需要在AndroidManifest.xml中加入两行配置
- <uses-permission android:name="android.permission.CALL_PHONE" />
- <uses-permission android:name="android.permission.SEND_SMS"/>