Android sends MMS messages

Source: Internet
Author: User
/*** Send audio ** @ Param file audio file */private void mms_audio (File file) {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 :"));}

The following methods are collected and sent through the intent provided by Android. For details, see the code.

/***** Send MMS * @ Param file address * @ Param body */private void sendmms_image (string file, string body) {intent = new intent (intent. action_send); intent. setclassname ("com. android. MMS "," com. android. MMS. UI. composemessageactivity "); intent. putextra ("subject", "MMS topic"); intent. putextra ("sms_body", body); intent. putextra ("Address", "12222222"); intent. putextra (intent. extra_stream, Uri. parse (filedir + file); intent. settype ("image/*"); startactivity (intent);}/*** send SMS * @ Param file body */private void sendsms (string file) {intent = new intent (intent. action_send); intent. setclassname ("com. android. MMS "," com. android. MMS. UI. composemessageactivity "); intent. putextra ("subject", "SMS 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);}

 

 

/*** Send the video file * @ Param file the video file */private void mms_video (File file) {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 :"));}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.