/** * 發送音頻 * @param file 音頻檔案 */private void mms_Audio(File file){Intent intent = new Intent(Intent.ACTION_SEND,Uri.parse("mms://"));intent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");Uri fileUri=queryUriforAudio(file);intent.putExtra(Intent.EXTRA_STREAM, fileUri);intent.setType("audio/*");//startActivity(intent);startActivity(Intent.createChooser(intent, "MMS:"));}
下面的各種方法均是通過android內建的intent進行採集的發送的,見代碼
/** * * 發送多媒體訊息 * @param file 檔案地址 * @param body */private void sendMMS_Image(String file,String body){Intent intent = new Intent(Intent.ACTION_SEND);intent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");intent.putExtra("subject", "多媒體訊息主題");intent.putExtra("sms_body", body);intent.putExtra("address", "12222222");intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(filedir+file));intent.setType("image/*");startActivity(intent);}/** * 傳送簡訊 * @param file body */private void sendSMS(String file){Intent intent = new Intent(Intent.ACTION_SEND);intent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");intent.putExtra("subject", "簡訊主題");intent.putExtra("sms_body", file);intent.putExtra("address", "12222222");intent.setType("text/plain");startActivity(intent);}
private void slideShow(File f1,File f2){ArrayList<Uri> uris = new ArrayList<Uri>();final Intent mmsIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);mmsIntent.setType("*/*");//mmsIntent.setType("*/*");mmsIntent.putExtra("address", "0123456");mmsIntent.putExtra("sms_body", "the body");//mmsIntent.putExtra(name, value)//Uri u= queryUriforAudio(f1);uris.add(queryUriforAudio(f1));uris.add(Uri.fromFile(new File(Environment.getExternalStorageDirectory()+"/"+"text.txt")));uris.add(Uri.fromFile(new File(Environment.getExternalStorageDirectory()+"/"+getText("image/jpeg")[0])));uris.add(queryUriForVideo(f2));//mmsIntent.putpmmsIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);//this.startActivityForResult(Intent.createChooser(mmsIntent, "success"), 1);startActivity(mmsIntent);}
/** * 發送視頻檔案 * @param file 視頻檔案 */private void mms_Video(File file){Intent intent = new Intent(Intent.ACTION_SEND,Uri.parse("mms://"));intent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");Uri fileUri=queryUriForVideo(file);intent.putExtra(Intent.EXTRA_STREAM, fileUri);intent.setType("video/*");startActivity(Intent.createChooser(intent, "MMS:"));}