从我自己的应用程序启动短信活动@ConversarionList.class

发布于 2024-09-04 06:46:37 字数 1081 浏览 4 评论 0 原文

我进行了研究,发现很多人出于意图启动短信应用程序,问题是人们通常倾向于仅针对传出消息执行此操作。

我目前在我的应用程序上显示未读短信计数,但似乎我无法获得正确的工作意图。

每次尝试我都会得到相同的结果,它会启动应用程序,但要发送新的短信...

我当前的意图如下所示

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

,其结果是:

Android 短信申请表

  • 编辑:Para ->致
  • Escribir mensaje ->写消息
  • Enviar ->发送

我希望我对此足够清楚。

问题是:

如何通过 Intent 进入 Android 上的短信应用程序的收件箱?


编辑:我只想复制此内容:

startActivity(new Intent(this, ConversationList.class));

我从以下位置获取:< a href="http://www.google.com/codesearch/p?hl=en#dpDz7Q08o9c/src/com/android/mms/ui/ComposeMessageActivity.java" rel="nofollow noreferrer">http://www .google.com/codesearch/p?hl=en#dpDz7Q08o9c/src/com/android/mms/ui/ComposeMessageActivity.java @LINE:2028

在我自己的应用程序上。但我似乎无法让它发挥作用。

I've done my research and found plenty of people launching the sms application from an intent, The thing is that people usually tend to do this only for outgoing messages.

I'm currently displaying a Unread Sms Count on my app, but it seams I can't get the proper intent to work.

On every try I get the same result, It launches the app but for a new sms...

My current intent looks like this

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

and it's result is:

Android sms Aplication form

  • EDIT: Para -> To
  • Escribir mensaje -> Write Message
  • Enviar -> Send

I hope I'm clear enough about this.

The question is:

How can I go to the inbox of the sms application on Android via an Intent?


EDIT: I just want to replicate this:

startActivity(new Intent(this, ConversationList.class));

Which I took from: http://www.google.com/codesearch/p?hl=en#dpDz7Q08o9c/src/com/android/mms/ui/ComposeMessageActivity.java @LINE: 2028

On my own app. But I can't seem to get it to work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我要还你自由 2024-09-11 06:46:37

什么是SetClassName?

为了启动位于当前应用程序外部的类,我们需要声明它的“完整路径”之类的东西...

为了打开默认的短信应用程序@ConversationList,我们需要这样做:

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setClassName("com.android.mms", "com.android.mms.ui.ConversationList");

来源:

What is SetClassName?

In order to start a class located outside the current application we need to declare something like a "Full Path" to it...

In order to open the default sms Application @ConversationList we need to do this:

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setClassName("com.android.mms", "com.android.mms.ui.ConversationList");

Source:

冷了相思 2024-09-11 06:46:37
  1. 首先,查看不同的意图和定位选项。您可以查看我对类似问题的回答。您的代码将使用 StartActivityForResult() 调用某些内容。这是一个更难的问题。

  2. 如果幸运的话,您可以从消息传递应用程序中找到状态的 INTENT。您可能不会,因为不能保证手机将使用系统默认设置。毕竟,当收到 SMS 时,它会被放入某个消息传递数据库中,并且仅根据消息传递应用程序逻辑,它才是“新的”。出于安全原因,该数据库不共享。您可能想对此功能请求发表评论。

  3. 您可以编写自己的应用程序来获取“新短信”意图,然后将其转发。请参阅此有点旧的教程

祝你好运!如果您取得进展,请告诉我们。

  1. First, look over the different intent and lanch options. You can see my answer to a similar question. Your code will call something with an StartActivityForResult(). What that is a harder question.

  2. If you are lucky, you can find an INTENT from the messaging application for status. You probably won't, as there isn't a guarantee the phone will be using the system default. After all, when an SMS is received it is put in some messaging database and is 'new' only according to the messaging applications logic. That database isn't shared, for security reasons. You might want to comment on this feature request.

  3. You can write your own application that grabs the 'new SMS' intent and then sends it forward, maybe. See this somewhat old tutorial.

Good luck! Let us know if you make progress.

染墨丶若流云 2024-09-11 06:46:37

意图 smsIntent = new Intent(Intent.ACTION_VIEW);

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

smsIntent.putExtra("地址", "12125551212");

smsIntent.putExtra("sms_body","消息正文");

startActivity(smsIntent);

Intent smsIntent = new Intent(Intent.ACTION_VIEW);

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

smsIntent.putExtra("address", "12125551212");

smsIntent.putExtra("sms_body","Body of Message");

startActivity(smsIntent);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文