![](/img/trans.png)
[英]Android : How to share photo with CAPTION via Android share intent on Facebook?
[英]How to share photo with CAPTION via Android share intent on Facebook?
我想通过Facebook上的分享意图与我的应用程序预先填充的标题分享照片。
我知道如何分享照片或如何分享文字,但我如何分享它们?
示例代码
Intent shareCaptionIntent = new Intent(Intent.ACTION_SEND);
shareCaptionIntent.setType("image/*");
//set photo
shareCaptionIntent.setData(examplePhoto);
shareCaptionIntent.putExtra(Intent.EXTRA_STREAM, examplePhoto);
//set caption
shareCaptionIntent.putExtra(Intent.EXTRA_TEXT, "example caption");
shareCaptionIntent.putExtra(Intent.EXTRA_SUBJECT, "example caption");
startActivity(Intent.createChooser(shareCaptionIntent,getString(R.string.share)));
如果设置类型为image/*
则上传照片时不会预填充字幕。 如果设置为text/plain
仅上传没有照片的标题.....
我的猜测是问题是Android Facebook应用程序在过滤ACTION_SEND
Intent并且类型为image/*
进行照片上传时不会查找Intent.EXTRA_TEXT
。 因此,如果Android Facebook应用程序查找该值,则可以解决此问题,如果存在,则将其作为图像的标题插入。
将此行添加到现有代码中:
shareCaptionIntent.putExtra(Intent.EXTRA_TITLE, "my awesome caption in the EXTRA_TITLE field");
EXTRA_TITLE,EXTRA_SUBJECT和EXTRA_TEXT之间没有明确的差异。 所以没有明确的共享协议。 我们总是可以尝试所有这些。 :-)
这个问题似乎是Facebook应用程序的长期“功能”。 它的意图处理从未处于完全功能状态。
查看http://forum.developers.facebook.net/viewtopic.php?id=93900上的链接
这需要与Facebook的开发人员一起提升。 依赖隐藏在客户端API之后而不是修复显而易见的东西正在对他们起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.