android发送短信界面,android调用系统发送短信 和 已发送短信界面

本文详细介绍了如何在Android系统中调用短信发送和已发送短信界面的Intent。通过ACTION_SENDTO启动短信发送界面,指定接收人和内容;使用ACTION_MAIN打开已发送短信界面。同时,讨论了ACTION_VIEW的不推荐用法,因为无法接收数据。

1. 调用系统发送短信界面(并指定短信接收人和短信内容)

Uri smsToUri = Uri.parse("smsto:10086");

Intent mIntent = new Intent(android.content.Intent.ACTION_SENDTO, smsToUri );

mIntent.putExtra("sms_body", "The SMS text");

startActivity( mIntent );

2. 调用系统已发送短信界面

Uri  smsUri = Uri.parse("smsto:106900867734");

Intent intent = new Intent(Intent.ACTION_MAIN, smsUri)

intent.setType("vnd.android-dir/mms-sms");

startActivity(intent);

这里我们使用action_main 根据api显示提示

android.content..ACTION_MAIN = "android.intent.action.MAIN"

public static finalACTION_MAINSince:

Activity Action: Start as a main entry point, does not expect to receive data.

Input: nothing

Output: nothing

Constant Value:"android.intent.action.MAIN"

下面这种操作其实不推荐,因为传递的smsto并无法接收。

Uri  smsUri = Uri.parse("smsto:106900867734");

Intent intent = new Intent(Intent.ACTION_VIEW,smsUri)

intent.setType("vnd.android-dir/mms-sms");

startActivity(intent);

根据api提示:

android.content..ACTION_VIEW = "android.intent.action.VIEW"

public static finalACTION_VIEWSince:

Activity Action: Display the data to the user. This is the most common action performed on data -- it is the generic action you can use on a piece of data to get the most reasonable thing to occur. For example, when used on a contacts entry it will view the entry; when used on a mailto: URI it will bring up a compose window filled with the information supplied by the URI; when used with a tel: URI it will invoke the dialer.

Input:is URI from which to retrieve data.

Output: nothing.

Constant Value:"android.intent.action.VIEW"

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值