Android系统中发送短信和彩信的源码

2020-06-12  本文已影响0人  程序媛宝

开发过程,将开发过程常用的内容段做个珍藏,如下资料是关于Android系统中发送短信和彩信的的内容,应该是对各位有较大用处。

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(fd.getAbsoluteFile());

Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mmsto", number, null));

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

上一篇下一篇

猜你喜欢

热点阅读