应用层发彩信和短信

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);

以上代码是发彩信。







你可能感兴趣的:(String,File,null,action,sms)