通过意图在Facebook上分享文本而不使用Facebook sdk [英] Share text via Intent on Facebook without using Facebook sdk
问题描述
由于Facebook不允许通过Intent共享文本,除非我们使用Facebook sdk,我正在寻找一种方法来实现这一点。
As Facebook doesn't allow sharing text via Intent unless we use Facebook sdk, I am looking for a way around to achieve this.
我可以想到3我可以使用的黑客:
I can think of 3 hacks which I can use:
1)由于Facebook允许图像共享,我可以生成一个位图
与共享文本绘制并使用 Intent
共享图像。
1) As Facebook allows image sharing, I can generate a Bitmap
with sharing text drawn onto it and share the image using Intent
.
2)Facebook允许共享URL,它也显示共享时页面的头
。我可以在我的服务器上托管一个专用页面,并将值作为参数传递给url,并使用它生成 Head
(我没有PHP的经验,但我猜这个可以)
2) Facebook allows sharing URLs, for which it also displays the Head
of the page while sharing. I can host a dedicated page on my server and pass values as parameter in the url, and generate the Head
using it.(I have no experience with php, but I guess this is possible)
3)将文本复制到剪贴板并通知用户。
3) Copy text to clipboard and notify user about this.
/ strong>
OR
使用所有3的组合。
任何人都可以建议我一个更好的方式来分享我的Facebook在Facebook上的内容没有使用Facebook sdk?
Can anyone suggest me a much better way around to share my content on Facebook without using Facebook sdk?
提前感谢
推荐答案
没有办法,您可以在Facebook中使用android shareIntent
分享文本。
There is no way you can share Text alone in the Facebook using android shareIntent
.
只有通过Facebook SDK才能使用共享链接功能。
It is possible only through Facebook SDK using share links functions.
如果有图像,Facebook会从意图忽略Extra Text。您可以共享图像,但不允许您共享文本内容。
Facebook simply ignores the Extra Text from the intent if there is an image. You can share image, but it does not allow you to share the Text content.
不幸的是,Facebook共享意图只能使用带有前缀http://的单个URL没有额外的短信。实际上,Facebook剥离文本内容,只允许URL / Link。这是通过设计,我们无法控制。
Unfortunately the Facebook sharing intent can only take a single URL with prefixed http:// and no additional text message. Actually facebook strips out the text content and allows only URL/Link. It is by Design and we have no control over it.
这将工作
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "http://www.google.com");
startActivity(Intent.createChooser(sharingIntent, "Share via"));
这不行。
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "Share Text from App");
startActivity(Intent.createChooser(sharingIntent, "Share via"));
只有你可以在Facebook上分享文本使用Facebook
SDK。
参考链接
这篇关于通过意图在Facebook上分享文本而不使用Facebook sdk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!