简体   繁体   English

以编程方式在Android中发送彩信

[英]Send MMS in Android programmatically

I'm looking for a way to send MMS message behind the scenes in android without opening a chooser intent. 我正在寻找一种方法在android中幕后发送彩信,而无需打开选择器意图。 There is no api available for it at the moment. 目前还没有api可用。 is there anyone that could help me that would be great. 是否有任何人可以帮助我,这将是伟大的。 I've already tried this but it doesn't work for me. 我已经试过了,但它对我不起作用。

The code provided from the link you posted worked for me and several other folks here who have posted questions. 您发布的链接提供的代码为我和其他几个已发布问题的人工作。 Depending on the MMSC you are trying to send to, you may be required to insert a particular header (such as in the case with Metro PCS's MMSC) but I assure you the code works with very little modification. 根据您尝试发送的MMSC,可能需要插入特定的标题(例如Metro PCS的MMSC),但我向您保证代码的工作只需要很少的修改。

MMS is a HTTP based request in Android. MMS是Android中基于HTTP的请求。 You have to have mobile data to send an MMS. 您必须拥有移动数据才能发送彩信。 There are no APIs exposed by Android to send an MMS, as they have APIs for SMS. Android没有公开发送MMS的API,因为它们有用于SMS的API。 If you want your application to send MMS you will have to write everything. 如果您希望您的应用程序发送彩信,您将必须编写所有内容。 Please refer the AOSP code. 请参阅AOSP代码。 https://github.com/android/platform_packages_apps_mms OR you can simply build the Intent and then launch the native Messaging App. https://github.com/android/platform_packages_apps_mms或者您可以简单地构建Intent,然后启动本机Messaging App。

By giving the mobile No and Subject.And attach the image. 通过给手机号码和主题。并附上图像。

Uri uri = Uri.parse("file://"+Environment.getExternalStorageDirectory()+"/test.png");
    Intent i = new Intent(Intent.ACTION_SEND);
    i.putExtra("address","1234567890");
    i.putExtra("sms_body","This is the text mms");
    i.putExtra(Intent.EXTRA_STREAM,"file:/"+uri);
    i.setType("image/png");
    startActivity(i);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM