Android如何发送mms?

时间:2014-05-23 06:50:10

标签: android mms

我正在尝试使用

从Android应用程序发送mms
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra("sms_body", "Sent using Spootur");
sendIntent.setType("image/png");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagePath)));
startActivityForResult(sendIntent, SEND_ACTIVITY);

但它是打开一个Android默认共享弹出窗口,但我想直接启动mms窗口我怎么能这样做

Thnaks

1 个答案:

答案 0 :(得分:0)

尝试这个

Uri uri = Uri.parse("file://"+Environment.getExternalStorageDirectory()+"/test.png");
Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra("address","to address");
i.putExtra("sms_body","ent using Spootur");
i.putExtra(Intent.EXTRA_STREAM,"file:/"+uri);
i.setType("image/png");
startActivity(i);

必须在AndroidManifest中进行更改

<uses-permission android:name="android.permission.RECEIVE_MMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />