当前位置:操作系统 > 安卓/Android >>

android调用系统短信功能

附带电话号码:
[java] 
Intent mIntent = new Intent(Intent.ACTION_VIEW);   
            mIntent.putExtra("address",phoneNum);   
            mIntent.putExtra("sms_body", "");   
            mIntent.setType("vnd.android-dir/mms-sms");   
            context.startActivity(mIntent);   
附带短信内容:
[java]
Uri smsToUri = Uri.parse("smsto:");// 联系人地址 
            Intent mIntent = new Intent(android.content.Intent.ACTION_SENDTO, 
                    smsToUri); 
            mIntent.putExtra("sms_body", 
                    "abcdefgh");// 短信内容 
            context.startActivity(mIntent); 
附带邮件内容:
[java]
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
            // 文本格式 
            emailIntent.setType("text/plain"); 
            // 对方邮件地址 
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, ""); 
            // 标题内容 
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, ""); 
            // 邮件文本内容 
            emailIntent 
                    .putExtra(android.content.Intent.EXTRA_TEXT, 
                            "abcdefgh"); 
            context.startActivity(Intent.createChooser(emailIntent, 
                    "Choose Email Client")); 

 

作者:DJCKEN
补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,