Android的MMS意图与图片及正文 [英] Android MMS Intent with with Image and body text

查看:189
本文介绍了Android的MMS意图与图片及正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个意图将启动彩信软件,我附有图片文件,以及一些pre定义的文本present在邮件正文中。

I am trying to create an intent that will start the MMS application for me with an image file attached and some pre-defined text present in the message body.

到目前为止,我已经在同一时间能够完成一个或,但不能同时使用。

Thus far I've been able to accomplish either or, but not both at the same time.

事情我已经尝试过(他们的结果):

Things I've tried (with their results):

sendIntent = new Intent(android.content.Intent.ACTION_SEND,Uri.parse("mms://"));
sendIntent.setType("image/gif");
sendIntent.putExtra(Intent.EXTRA_STREAM, imgStreamUri);
sendIntent.putExtra("sms_body", "HelloWorld");
startActivity(Intent.createChooser(sendIntent,"Send"));    
/**********
Image file is attached but no text added to message body.
 **********/

sendIntent = new Intent(android.content.Intent.ACTION_SEND);
sendIntent.setType("image/gif");
sendIntent.putExtra(Intent.EXTRA_STREAM, imgStreamUri);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "HelloWorld");
sendIntent.putExtra(Intent.EXTRA_TITLE, "WorldHello");
startActivity(Intent.createChooser(sendIntent,"Send"));
/**********
Image file is attached but no text added to message body(or subject or anything).
 **********/

有谁知道我可以将两种主体文本和图像文件,以彩信的意图,将启动默认的消息传递应用程序填充了合适的项目?

Does anyone know how I can attach both body text and an image file to an mms intent that will launch the default messaging application with the appropriate items filled in?

编辑:经过测试,在答案中提供的code @lenik。这是工作在某些设备上,这里是我发现

Tested the code @lenik provided in answer. It is working on some devices, here's what I found

正确使用:

  • 在4G的史诗(银河S)
  • 史诗的4G触摸(GALAXY S II)
  • 在Galaxy Nexus的(ICS 4.0.4)
  • 的HTC Desire(升级Froyo 2.2)
  • 摩托罗拉光子

图片连接,但没有文字:

Image attached but no text:

  • 的Sidekick4克
  • 三星变换超

任何人都知道,如果我基本上s.o.l.在设备不正常这样?

Anyone know if I am basically s.o.l. on the devices that don't work properly this way?

推荐答案

以下code对我的作品:

The following code works for me:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "Hi how are you");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/file.gif")));
intent.setType("image/gif"); 
startActivity(Intent.createChooser(intent,"Send"));

这篇关于Android的MMS意图与图片及正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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