Android的Facebook的Messenger的分享纯文本文件 [英] Android Facebook Messenger share plain file
问题描述
我使用Facebook的SDK 4.2发送一个文件(特别,我导出一个序列化对象)通过Facebook Messenger的为Android。
但是,每个人只提到图片,音频和视频。即使是文档不提text / plain的所支持的MIME类型。
出curosity的,我决定尝试用图像/ JPEG共享文件和它的工作。文件发送和信使允许下载它,但我不认为这是正确的方式。这感觉就像它会启动一些更新后崩溃的应用程序。如何正确地执行此操作?
私人无效份额(){
文件file = getMyFileMethod();
URI URI = Uri.fromFile(文件);
字符串MIME_TYPE =图像/ JPEG; ShareToMessengerParams STMP = ShareToMessengerParams.newBuilder(URI,MIME_TYPE).build();
MessengerUtils.shareToMessenger(这一点,0,STMP);
}
我能想到的一种可能的方式是创建一个位图出来的文字数据,然后将其作为一个实际的JPEG。
I'm using Facebook SDK 4.2 to send a file (specifically, I'm exporting a serialized object) via Facebook Messenger for Android.
However, everyone only mentions images, audio and videos. Even the docs don't mention "text/plain" as supported MIME type.
Out of curosity I decided to try sharing file using "image/jpeg" and it worked. File is sent and the messenger allows to download it, but I don't think this is the accurate way. It feels like it will start to crash the app after some update. How to perform this action properly?
private void share(){
File file = getMyFileMethod();
Uri uri = Uri.fromFile(file);
String mime_type = "image/jpeg";
ShareToMessengerParams stmp = ShareToMessengerParams.newBuilder(uri, mime_type).build();
MessengerUtils.shareToMessenger(this, 0, stmp);
}
One possible way I can think of is create a bitmap out of the text data and then send it as an actual jpeg.
这篇关于Android的Facebook的Messenger的分享纯文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!