android - Facebook 分享 - 缺少文本

标签 android facebook facebook-graph-api

原始问题

我做了更多研究,请参阅帖子底部的信息。谢谢!

我有一个 Android 应用程序,带有 Facebook 共享选项。我主要从 Fb 上的教程中完成了应用程序的共享部分。开发。网站,请参阅:https://developers.facebook.com/docs/android/share

这是实际的代码:

Request.newMeRequest(session, new Request.GraphUserCallback() {
    @Override
    public void onCompleted(GraphUser user, Response response) {
        Bundle postParams = new Bundle();
        String name = String.format(getResources().getString(R.string.shareFacebook_title), user.getName(), petName);
        String caption = String.format(getResources().getString(R.string.shareFacebook_caption));
        String description = String.format(getResources().getString(R.string.shareFacebook_description), user.getName(), petName, shelterName);
        postParams.putString("name", name);
        postParams.putString("caption", caption);
        postParams.putString("description", description);
        postParams.putString("link", getResources().getString(R.string.shareFacebook_url));
        postParams.putString("picture", petPicUrl);

        Request request = new Request(session, "me/feed", postParams,
                HttpMethod.POST);

        RequestAsyncTask task = new RequestAsyncTask(request);
        task.execute();
    }
}).executeAsync();

我的问题是,共享链接没有我放入bundle 中的所有文本。看图:

Facebook share

当我运行调试器并调试到应用程序时,所有 postParams 运行正常,Bundle 包含所有文本,但共享看起来一样(并且没有所有的文本)。
Bundle 抛出一些意外的 ClassNotFoundExceptions,但我认为这是 IDE 中的一个错误,参见 SO question .

Debugging in the IDE

所有手机中丢失的文本都不相同。在某些手机上,图片也是小姐,但我确定 URL 是正确的。

我知道,这在 2-3 周前有效,直到今天才有人碰过这段代码。

你能帮我看看是什么问题造成的吗?
谢谢!

编辑

我试过 Facebook 的 Graph API Explorer , 发送相同的查询,我得到了相同的结果(缺少文本等)。

这是查询:

The same query from the Graph API Explorer

Graph API 是否有可能错误/损坏?过去几周有变化吗? status page说,API 是健康的。

编辑#2

好的,所以如果我想分享任何链接,选择属性就可以了。但是,如果我想分享指向 Google Play 的链接,属性将停止工作。

最佳答案

可能这导致了我的问题,Google Play 商店在代码中定义了 oauth 标签,因此 FB 解析该标签而不是我的内容。

我发现最好的解决方案是链接到一个空白站点,然后我使用 JavaScript 重定向我的用户。

关于android - Facebook 分享 - 缺少文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26844654/

相关文章:

android - 如何以编程方式设置gridview的高度android

ios - 为 iOS 应用程序提交开放图操作?

security - 使用外部 oauth2 提供商(facebook)时,我的应用程序是否应该发出自己的访问 token ?

css - Facebook Like 社交插件大小问题

Facebook 实时更新仅返回 "changed_fields": ["feed"] and not the actual comment

ios - 使用 iOS SDK 将多张照片作为单个帖子上传,例如时间轴照片,而不是 Facebook 中的相册

Android:处理阿拉伯语等从右到左语言的整数 (%1$d) 和字符串 (%1$s) 参数

java - 神秘持久的 ClassNotFoundException(主要 Activity )

java - 从按钮监听器调用 onPause()、onStop 和 onDestroy

ios - swift 4 : Navigation Controller unwanted looping