Android的 - 如何附加文件以短信? [英] Android - How to attach file to SMS?

查看:118
本文介绍了Android的 - 如何附加文件以短信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过短信发送名片。所以,我使用的.vcf文件。

I need to send contact via SMS. So, I'm using .vcf file.

不过,我需要重视它在Android SDK中的短信。有内部的Andr​​oid这样的功能。我已经试了一下我的智能手机;

Still, I need to attach it to sms within android SDK. There IS such function within android. I've tried it on my smartphone;

我在寻找做到这一点的天,一切的办法,我发现到目前为止是的这个不错的库来构建电子名片和<一href="http://developer.android.com/reference/android/telephony/SmsManager.html#sendDataMessage%28java.lang.String,%20java.lang.String,%20short,%20byte%5B%5D,%20android.app.PendingIntent,%20android.app.PendingIntent%29"相对=nofollow>的SmsManager的类此方法。

I was searching for the way to do that for days and everything I've found so far was this nice library to construct vCard and this method of SMSManager class.

有谁知道如何做到这一点???我想,这个问题的解决方案,将努力不仅为VCF,但对于任何文件扩展名。

Does anyone know how to do that??? I suppose solution of this problem shall work not only for vcf, but for any file extension.

如果您将添加一些code,例如,你会让我快乐))

If you'll add some code as an example you will make me happy))

推荐答案

既然你有一个文件对象,你可以发送彩信,它可以用这个code

Since you have a File object, you can send MMS with it, by using this code

            Intent sendIntent = new Intent(Intent.ACTION_SEND);
            sendIntent.setType("text/x-vcard");
            sendIntent.putExtra(Intent.EXTRA_STREAM,
                    Uri.parse(outputFile.toURL().toString()));
            startActivity(sendIntent);

这篇关于Android的 - 如何附加文件以短信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆