快速調用系統內建的簡訊程式來發送多媒體訊息,總結了網上各位朋友的資源,經過自己親自的測試。請大家關注我的後續文章,我正在研究使用自己的程式來發送多媒體訊息以及接收多媒體訊息,接受多媒體訊息這塊可能是一大痛點(不是簡單的讀取多媒體訊息資料庫,而是攔截多媒體訊息),如果大家有興趣,跟我一起交流交流。
package com.zhf.mms1;import java.io.File;import android.app.Activity;import android.content.Intent;import android.net.Uri;import android.os.Bundle;/** * 調用系統的發多媒體訊息功能 * * @author Administrator * */public class MMSDemo1Activity extends Activity {@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);Intent sendMSGIntent = new Intent(Intent.ACTION_SEND);sendMSGIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);sendMSGIntent.putExtra("address", "10086");// 對方號碼sendMSGIntent.putExtra("subject", "發送多媒體訊息");// 多媒體訊息主題sendMSGIntent.putExtra("sms_body", "this is mms send auto ");// 附加文字說明sendMSGIntent.putExtra("compose_mode", false);// 編輯模式sendMSGIntent.putExtra("exit_on_sent", true);// 發送完自動結束// 添加照片等附件sendMSGIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(new File("/sdcard/tempPic.jpg")));// dirPath為一個sdcard地址如:"/sdcard/Myshares/Myphotos/m.jpg"sendMSGIntent.setClassName("com.android.mms","com.android.mms.ui.ComposeMessageActivity");// 設定檔案類型sendMSGIntent.setType("image/jpeg");// 開啟發送多媒體訊息的頁面startActivity(sendMSGIntent);}}