简体   繁体   English

具有Android意图的非媒体附件的MMS

[英]MMS with non-media attachment using Android intents

I would like to attach a .ics file (icalendar file) to an MMS message, but the android messaging application seem restricted to media attachments only. 我想将.ics文件(icalendar文件)附加到彩信中,但是android短信应用程序似乎仅限于媒体附件。 The MMS application opens with everything in order (To and body fields) but there is no trace of the attachment, as if it had been completely ignored. MMS应用程序将按顺序打开所有内容(“收件人”和“正文”字段),但没有任何附件痕迹,就好像它已被完全忽略一样。

I am using android intents, the code is the following: 我正在使用android intents,代码如下:

String uri = "file:///mnt/sdcard/meeting.ics";
Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.putExtra("address", toMMS);
sendIntent.setType("text/calendar");
sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
sendIntent.putExtra("sms_body", "You've been invited to a new meeting"); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(uri));
this.startActivity(sendIntent);

I also tried without success, chaging the MIME type: 我也尝试不成功,改变了MIME类型:

sendIntent.setType("text/*"); 

or 要么

sendIntent.setType("text/plain");

I tested all the above cases with a plain txt file, but there is still no attachment. 我使用纯文本文件测试了上述所有情况,但仍然没有附件。 The standard MMS android application doesn't seem to accept non-media file attachments. 标准的MMS android应用程序似乎不接受非媒体文件附件。

I also tried to completely remove the setType line, but then the message application crashes when started. 我也尝试完全删除setType行,但是启动后消息应用程序崩溃。

So, does anybody know how to attach a non-media file to an MMS message? 那么,有人知道如何将非媒体文件附加到彩信吗? Or if it is impossible? 还是不可能?

My phone is: Google Nexus S Android version 2.3.4 我的手机是:Google Nexus S Android 2.3.4版

Thanks in advance. 提前致谢。

PD: the same issue was asked here, but without answer: Sending an MMS with a vCard attachment on Android devices PD:在此问了同样的问题,但没有答案: 在Android设备上发送带有vCard附件的MMS

The Messaging application only has code to support the attachment of specific kinds of files, it generates what is essentially a SMIL document (even when the "attachment" is a single image). Messaging应用程序仅具有支持特定类型文件附件的代码,它会生成实质上是SMIL文档的文件(即使“附件”是单个图像)。 If you want to send an MMS with other attachment types, you'll need to go deeper than that. 如果您要发送带有其他附件类型的MMS,则需要更进一步。

You can see what I mean by looking at the ComposeMessageActivity , particularly the definition of mAttachmentEditorHandler. 通过查看ComposeMessageActivity可以了解我的意思,尤其是mAttachmentEditorHandler的定义。

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

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