Android - 如何将文件附加到短信?

标签 android file sms vcf-vcard

我需要通过短信发送联系信息。所以,我正在使用 .vcf 文件。

仍然,我需要将它附加到 android SDK 中的短信。 android中有这样的功能。我已经在我的智能手机上试过了;

几天来我一直在寻找这样做的方法,到目前为止我发现的所有内容都是 this nice library to construct vCardthis method of SMSManager class .

有人知道怎么做吗???我想这个问题的解决方案不仅适用于 vcf,而且适用于任何文件扩展名。

如果您添加一些代码作为示例,您会让我很高兴))

最佳答案

因为你有一个文件对象,你可以用它发送彩信,通过使用这个代码

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 - 如何将文件附加到短信?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10420312/

相关文章:

android - Glide Picasso 不会加载本地存储视频的缩略图路径

android - API below 21 的 alertdialog.builder.setview 的替代方案

android - 将 cookie 发送到下一个 Activity android

ios - 如何在 swift 中将快速更新的字符串附加到文件中

Java串行通信PortInUseException

Android:从特定号码接收短信?

android - 我不断收到错误 "No Activity found to handle Intent"

java - Android Studio : Editing a . txt 文件在内部存储中与 EditText

python - 迭代字符串列表,直到 string == newline

java - 发送短信时出错