首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Facebook共享缺失的文本

Facebook共享缺失的文本
EN

Stack Overflow用户
提问于 2014-11-10 13:11:11
回答 2查看 1K关注 0票数 6

原问题

我做了一些更多的调查,看看文章底部的信息。谢谢!

我有一个Android应用程序,有脸书分享选项。我做了应用程序的分享部分,大部分来自Fb上的教程。Dev.网站,见:https://developers.facebook.com/docs/android/share

以下是实际代码:

代码语言:javascript
复制
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中。见图:

当我运行调试器并在应用程序中调试时,所有的postParams都运行良好,Bundle拥有所有的文本,但是共享看起来是一样的(而不是所有的文本)。

Bundle抛出一些意想不到的ClassNotFoundExceptions,但我认为这是IDE中的一个错误,请参阅这个所以问题

所有电话中丢失的短信都不一样。在一些电话中,图片也会丢失,但我确信,URL是正确的。

我知道,这在2-3周前起作用了,直到今天才有人碰过这个密码。

你能帮帮我吗,是什么导致了这个问题?

谢谢!

编辑

我尝试了Facebook的图API资源管理器,发送同样的查询,我得到了相同的结果(丢失文本,等等)。

以下是查询:

图形API有可能是错误的/坏的吗?在过去的几周里有变化吗?状态页说,API是健康的。

Edit#2

好的,所以如果我想要共享任何链接,thoose属性可以工作。但是如果我想分享到Google的链接,这些属性就会停止工作。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-11-17 14:33:04

这可能导致了我的问题,Google Play Store在代码中定义了oauth标记,所以FB解析标记而不是我的内容。

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

票数 2
EN

Stack Overflow用户

发布于 2014-11-17 06:59:27

而不是这样使用Facebook拨号

代码语言:javascript
复制
private void publishFeedDialog() {
    Bundle params = new Bundle();
    params.putString("name", "Facebook SDK for Android");
    params.putString("caption", "Build great social apps and get more installs.");
    params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
    params.putString("link", "https://developers.facebook.com/android");
    params.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");

    WebDialog feedDialog = (
        new WebDialog.FeedDialogBuilder(getActivity(),
            Session.getActiveSession(),
            params))
        .setOnCompleteListener(new OnCompleteListener() {

            @Override
            public void onComplete(Bundle values,
                FacebookException error) {
                if (error == null) {
                    // When the story is posted, echo the success
                    // and the post Id.
                    final String postId = values.getString("post_id");
                    if (postId != null) {
                        Toast.makeText(getActivity(),
                            "Posted story, id: "+postId,
                            Toast.LENGTH_SHORT).show();
                    } else {
                        // User clicked the Cancel button
                        Toast.makeText(getActivity().getApplicationContext(), 
                            "Publish cancelled", 
                            Toast.LENGTH_SHORT).show();
                    }
                } else if (error instanceof FacebookOperationCanceledException) {
                    // User clicked the "x" button
                    Toast.makeText(getActivity().getApplicationContext(), 
                        "Publish cancelled", 
                        Toast.LENGTH_SHORT).show();
                } else {
                    // Generic, ex: network error
                    Toast.makeText(getActivity().getApplicationContext(), 
                        "Error posting story", 
                        Toast.LENGTH_SHORT).show();
                }
            }

        })
        .build();
    feedDialog.show();
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26844654

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档