Facebook帖子被取代Android

时间:2014-04-08 07:02:26

标签: android facebook facebook-graph-api facebook-requests

我正在开发一个Android应用程序,我试图在Facebook墙上发布。问题是,每次通过我的应用程序发布内容而不是发布新帖子时,我的旧帖子都会被新帖子取代。

以下是我的发布代码

private void publishStory(int item)
{
    Session session = Session.getActiveSession();

    if (session != null)
    {

        if(Session.getActiveSession() != null)
        {
            if (session.isOpened()) 
            {

                List<String> permissions = session.getPermissions();
                if (!isSubsetOf(PERMISSIONS, permissions)) {
                    Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(this, PERMISSIONS);
                    session.requestNewPublishPermissions(newPermissionsRequest);
                    return;
                }
            }

        }
        else
        {
            Toast.makeText(SecondScreen.this, "session not active", Toast.LENGTH_LONG).show();
            Log.e("session not active","session not active");
        }

        Bundle postParams = new Bundle();
        postParams.putString("name", String.valueOf(item));
        postParams.putString("caption", "test2");
        postParams.putString("description","I am @ ");
        postParams.putString("link", "http://maps.google.com/maps?q="+12+","+7);
        postParams.putString("picture", filepath);

        Request.Callback callback = new Request.Callback()
        {
            public void onCompleted(Response response)
            {
                FacebookRequestError error = response.getError();
                if (error != null)
                {
                    Toast.makeText(SecondScreen.this, "FacebookRequestError "+error, Toast.LENGTH_LONG).show();
                    Log.e("FacebookRequestError","FacebookRequestError "+error);

                }
                else
                {
                    try
                    {
                        Toast.makeText(SecondScreen.this, "successfully posted!!", Toast.LENGTH_LONG).show();
                        Log.e("successfully posted!!","successfully posted!!");
                    }
                    catch (Exception e)
                    {
                        Toast.makeText(SecondScreen.this, "Post Unsuccessful 1 !!!", Toast.LENGTH_LONG).show();
                        Log.e("Post Unsuccessful 1","Post Unsuccessful 1");
                    }

                }

            }
        };

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

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

}

请帮忙!谢谢!

0 个答案:

没有答案