0

I am developing an android app where I am trying to post on Facebook wall. The problem is, every time a post something through my app, instead of new posts getting posted, my older posts are getting replace by new ones.

Below is my publish code,

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();
    }

}

Please help! Thanks!

henrywright
  • 10,070
  • 23
  • 89
  • 150
  • This is not possible. Show some screenshots – Sahil Mittal Apr 08 '14 at 07:04
  • Hey @SahilMittal i found out reason for the posts getting replaced.Its facebook's anti-spamming technique to prevent duplicate posts.Thanks for replying.. :) – user3505559 Apr 08 '14 at 11:36
  • Hey @user3505559, That is a good find. Do you have solution to this problem? Facebook API says change the content to avoid this but it does not tell specifically what to change. Can you put some light? – user484691 Sep 26 '14 at 17:00

0 Answers0