文字说明没有在Facebook上共享 [英] Text Caption not shared on facebook

查看:140
本文介绍了文字说明没有在Facebook上共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想分享照片与说明,但文本标题没有在Facebook上分享有什么方式来分享图片使用Facebook发送意图的文本。

 列表<&意向GT; targetedShareIntents =新的ArrayList<&意向GT;();
意图份额=新意图(android.content.Intent.ACTION_SEND);
share.setType(图像/ JPEG);
清单< ResolveInfo> 。resInfo = getPackageManager()queryIntentActivities(份额,0);
如果(!resInfo.isEmpty()){
    对于(ResolveInfo信息:resInfo){
        意图targetedShare =新意图(android.content.Intent.ACTION_SEND);
        targetedShare.setType(图像/ JPEG); //这里把你的MIME类型
        如果(info.activityInfo.packageName.toLowerCase()。包括(nameApp)|| info.activityInfo.name.toLowerCase()。包括(nameApp)){
            targetedShare.putExtra(Intent.EXTRA_SUBJECT,虚拟镜像照片);
            targetedShare.putExtra(Intent.EXTRA_TEXT,这张照片是通过虚拟镜像创建的应用程序\\ n \\ nInfoshore团队。);
            targetedShare.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(新文件(的ImagePath)));
            targetedShare.setPackage(info.activityInfo.packageName);
            targetedShareIntents.add(targetedShare);
            isAppAvaiable = TRUE;
        }
    }
    意向chooserIntent = Intent.createChooser(targetedShareIntents.remove(0),选择应用程序共享);
    chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS,targetedShareIntents.toArray(新Parcelable [] {}));
    startActivity(chooserIntent);


解决方案

由于按照Facebook的平台策略,你不能$ P $使用P-填补份额对话
Intent.EXTRA_TEXT 。它通常被认为是一个错误,但根据bug报告提交这里也 rel=\"nofollow\">,脸谱明确提到,这是不是这种情况(这是不是一个错误)。

您可以阅读更多有关他们的平台策略具体而言,平台策略IV.2

从平台策略IV.2报价:


  

您不能pre-填充任何与下列有关的领域
  产品,除非用户手动生成的内容更早
  工作流程:流故事(用于USER_MESSAGE参数
  Facebook.streamPublish和FB.Connect.streamPublish和消息
  参数stream.publish),照片(标题),视频(介绍)
  注释(标题和内容),链接(注释),和Jabber / XMPP。


  
  

这些字段的目的是为用户前preSS自己。 pre-灌装
  这些领域的侵蚀用户的声音的真实性。


底线是(不幸),则不能添加标题您使用意图上传照片。你能做到这一点的唯一方法,就是在你的应用程序集成Facebook的SDK。看到他们是如何做到这一点在他们的示例应用程序的示例的 Hackbook 的,请参照<一个href=\"https://github.com/imkevinxu/totoro/blob/master/facebook-android-sdk-3.0/samples/Hackbook/src/com/facebook/android/Hackbook.java\"相对=nofollow>此链接向下滚动到行的 263 在那里他们处理上传了标题的照片。

I want to share photo with caption but text caption is not shared on Facebook Is there any way to share a text with photo on Facebook using send intent.

List<Intent> targetedShareIntents = new ArrayList<Intent>();
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("image/jpeg");
List<ResolveInfo> resInfo = getPackageManager().queryIntentActivities(share, 0);
if (!resInfo.isEmpty()){
    for (ResolveInfo info : resInfo) {
        Intent targetedShare = new Intent(android.content.Intent.ACTION_SEND);
        targetedShare.setType("image/jpeg"); // put here your mime type
        if (info.activityInfo.packageName.toLowerCase().contains(nameApp) || info.activityInfo.name.toLowerCase().contains(nameApp)) {
            targetedShare.putExtra(Intent.EXTRA_SUBJECT, "Virtual Mirror Photo");
            targetedShare.putExtra(Intent.EXTRA_TEXT,"This photo is created by Virtual Mirror App.\n\nInfoshore Team");
            targetedShare.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagePath)) );
            targetedShare.setPackage(info.activityInfo.packageName);
            targetedShareIntents.add(targetedShare);
            isAppAvaiable = true;
        }
    }
    Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "Select app to share");
    chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{}));
    startActivity(chooserIntent);

解决方案

As per the Facebook's Platform Policies, you cannot pre-fill the share dialog using Intent.EXTRA_TEXT. It is usually thought to be a bug, but as per a Bug Report filed here and also, here, Facebook clearly mentions that this is not the case (it's not a bug).

You can read more about their Platform Policies specifically, Platform Policy IV.2

Quote from Platform Policy IV.2:

You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow: Stream stories (user_message parameter for Facebook.streamPublish and FB.Connect.streamPublish, and message parameter for stream.publish), Photos (caption), Videos (description), Notes (title and content), Links (comment), and Jabber/XMPP.

These fields are intended for users to express themselves. Pre-filling these fields erodes the authenticity of the user voice.

The bottom line is (unfortunately), you cannot add a caption to a photo you are uploading using Intents. The only way you can do it, is integrating the Facebook SDK in your App. To see an example of how they do it in their sample app Hackbook, refer to this link and scroll down to line 263 where they deal with uploading a Photo with a Caption.

这篇关于文字说明没有在Facebook上共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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