Android發送多媒體訊息

來源:互聯網
上載者:User
/** * 發送音頻 * @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:"));}

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.