Android中发送短信和彩信

来源:互联网 发布:phpcms栏目绑定域名 编辑:程序博客网 时间:2024/05/02 04:58

发送短信:

String body="this is sms demo";Intent mmsintent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("smsto", number, null));mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, true);mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, true);startActivity(mmsintent); 

发送彩信:

StringBuilder sb = new StringBuilder();sb.append("file://");sb.append(fd.getAbsoluteFile());Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mmsto", number, null));// Below extra datas are all optional.intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_SUBJECT, subject);intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);intent.putExtra(Messaging.KEY_ACTION_SENDTO_CONTENT_URI, sb.toString());intent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, composeMode);intent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, exitOnSent);startActivity(intent);


原创粉丝点击