Android MMS意图与图像和正文

Foa*_*Guy 4 android message mms android-intent

我正在尝试创建一个intent,它将为我启动MMS应用程序,并附加一个图像文件,并在邮件正文中显示一些预定义的文本.

到目前为止,我已经能够完成任何一个或两个,但不能同时完成两个.

我尝试过的事情(结果):

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).
 **********/
Run Code Online (Sandbox Code Playgroud)

有没有人知道如何将正文和图像文件附加到mms意图,这将启动默认的消息应用程序并填入适当的项目?

编辑:测试了答案中提供的代码@lenik.它正在开发一些设备,这就是我发现的

工作正常:

  • 史诗4g(Galaxy S)
  • 史诗4g Touch(Galaxy S II)
  • Galaxy Nexus(ICS 4.0.4)
  • HTC Desire(Froyo 2.2)
  • 摩托罗拉Photon

附图但没有文字:

  • Sidekick 4g
  • 三星Transform Ultra

任何人都知道我是否基本上解决了这种方式无法正常工作的设备?

len*_*nik 8

以下代码适用于我:

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"));
Run Code Online (Sandbox Code Playgroud)