安卓:Facebook的3.0帖子上使用FQL请求响应(如Apr23,2013的)朋友墙 [英] Android: Facebook 3.0 Post on friends wall using the FQL request response (As of Apr23,2013)

查看:204
本文介绍了安卓:Facebook的3.0帖子上使用FQL请求响应(如Apr23,2013的)朋友墙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的朋友的应用程序生成的自定义列表视图通过他们的生日安排。所以我使用了 SELECT名,UID,pic_square,birthday_date从用户其中UID IN(SELECT UID2从朋友哪里UID1 =我()),以便通过birthday_date

My app generates custom listview of friends arrange by their birthday. So I have used SELECT name, uid, pic_square, birthday_date FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) order by birthday_date.

现在,当用户点击一个朋友(来自列表视图),它会提示用户如果他/她要张贴到朋友的墙。我知道该怎么做旧的方式,但我得到的,因为<一个迷惑href="http://stackoverflow.com/questions/15277381/how-to-send-a-post-to-facebook-friends-wall-android-sdk-3-0">How到后发送给Facebook好友的墙上的Andr​​oid SDK 3.0 。

Now when the user click a friend(from the listview) it will prompt the user if s/he want to post to that friends wall. I know how to do it the old way, but I'm getting confuse because of How to send a post to Facebook friend's wall android SDK 3.0 .

在这个问题:

Facebook的SDK为Android提供了让您发布的方法   故事从您的应用程序到用户的时间线。您也可以使用这个   张贴在您的用户代表的状态更新的方法。这种方法使用   图形API,是一种替代使用饲料对话框

The Facebook SDK for Android provides a method to let you publish stories from your app to a user's timeline. You can also use this method to post a status update on your user's behalf. This method uses the Graph API, and is an alternative to using the Feed Dialog

http://developers.facebook.com/docs /howtos/androidsdk/3.0/publish-to-feed/

也:

从不使用图形-API进行张贴在朋友的墙上。因为它是6禁用后,2013年二月FB建议ü使用给对话框张贴在朋友或你自己的墙上。这是链接如何使用饲料对话框:的http://开发商。 facebook.com/docs/howtos/androidsdk/3.0/feed-dialog

never use Graph-API for posting on friend's wall. because it is disabled after 6, Feb 2013. FB recommend u to use Feed Dialog for posting on friend's or your own wall. this is the link for how to use Feed Dialog : http://developers.facebook.com/docs/howtos/androidsdk/3.0/feed-dialog

我已经看到了这两个环节,但都只是说明如何张贴在自己的墙上。谁能给我 一个很好的最新的例子,或者至少,我指向正确的方向上如何发布使用通过Facebook的Andr​​oid SDK 3.x中FQL请求响应你的朋友的墙(如当下版本3.0.2b的)?

I have seen both links, but both only show how to post on your own wall. Can anyone give me a good latest example or at least, point me to the right direction on how to post to your friends wall using the FQL request response via Facebook Android SDK 3.x (As of the moment the version is 3.0.2b)?

推荐答案

我已经找到了解决方案。你只需要添加到和从参数。下面是我的示例:

I have found the solution. You only need to add the "to" and "from" parameters. Below is my sample:

对于墙面张贴到一个朋友:

    private void publishFeedDialog(String friend_uid) {
        Session session = Session.getActiveSession();
        if (!hasPublishPermission()) {
            // We don't have the permission to post yet.
            session.requestNewPublishPermissions(new Session.NewPermissionsRequest(this, WRITE_PERMISSION));
        }
        if (user != null && friend_uid != null && hasPublishPermission()) {

            final Activity activity = this;
            Bundle params = new Bundle();
            //This is what you need to post to a friend's wall
            params.putString("from", "" + user.getId());
            params.putString("to", friend_uid);
            //up to this
            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(this, 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(activity,
                                    "Posted story, id: "+postId,
                                    Toast.LENGTH_SHORT).show();
                            } else {
                                // User clicked the Cancel button
                                Toast.makeText(activity, 
                                    "Publish cancelled", 
                                    Toast.LENGTH_SHORT).show();
                            }
                        } else if (error instanceof FacebookOperationCanceledException) {
                            // User clicked the "x" button
                            Toast.makeText(activity, 
                                "Publish cancelled", 
                                Toast.LENGTH_SHORT).show();
                        } else {
                            // Generic, ex: network error
                            Toast.makeText(activity, 
                                "Error posting story", 
                                Toast.LENGTH_SHORT).show();
                        }
                    }

                }).build();
            feedDialog.show();
        }
    }

对于墙面张贴到很多朋友:

RequestsDialogBu​​ilder而不是FeedDialogBu​​ilder因为第二只允许在参数为多个ID,而第一个可以接收很多(不知道的限制,虽然,但我想大约是50)

RequestsDialogBuilder instead of FeedDialogBuilder because the second one only allows multiple ids on the parameter "to", while the first one can receive many (not sure about the limit though, but I think is about 50)

学分:gian1200

credits to: gian1200

这篇关于安卓:Facebook的3.0帖子上使用FQL请求响应(如Apr23,2013的)朋友墙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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