启动没有消息的默认短信应用 [英] Launch default SMS app without a message

查看:79
本文介绍了启动没有消息的默认短信应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的应用程序能够在单击按钮时启动用户的默认短信应用程序.目的不是让用户发送消息,而是查看他们当前的文本对话,因此,我不希望它启动SMS应用程序的新消息"活动,而是启动主应用程序本身.

I am wanting my app to, on a button click, launch the user's default texting app. The intention is not to have the user send a message, but to view their current text conversations, therefore I don't want it to launch the SMS app's "New Message" activity but instead the main app's activity itself.

如果我执行以下操作:

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setData(Uri.parse("sms:"));
context.startActivity(sendIntent);

然后启动它,我希望它启动应用程序的主要部分,而不是新的消息屏幕:

Then this is launched, instead I want it to launch the main part of the app, not this new message screen:

推荐答案

    Intent intent = new Intent(Intent.ACTION_MAIN);

    intent.addCategory(Intent.CATEGORY_DEFAULT);

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

    startActivity(intent);

这可能就是您想要的.

这篇关于启动没有消息的默认短信应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆