如何在Android 4.0+中发送带附加的mms

时间:2014-10-29 17:20:24

标签: android attachment mms

如何在Android 4.0+中发送带附加的mms?我试着这样:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
        sendIntent.setType("image/png");
        sendIntent.putExtra(Intent.EXTRA_STREAM,
                Uri.parse(outputFile.toURL().toString()));
        startActivity(sendIntent);

它在htc和samsung中运行良好,但它在Nexus 5(环聊)中不起作用。我试着这样:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
        sendIntent.putExtra("address", phonesBuilder2.toString());
        sendIntent.putExtra("sms_body", editTextTPMessage.getText());
        sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(makePicture()));

但文件没有附加。我尝试了很多方法,但各方面都有问题。

1 个答案:

答案 0 :(得分:1)

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