1

I write an android application which does a FB like to a FB post.

I succeed in doing it, but after a long time I get this response:

{
  Response:  responseCode: 400, 
  graphObject: null, 
  error: 
        {
         HttpStatus: 400, 
         errorCode: 100, 
         errorType: OAuthException, 
         errorMessage: (#100) Error finding the requested story
        },
 isFromCache:false
}

for the code:

Request request = new Request(
        session,
        takeFromPublicMacrosOrServer(currentOffer.postId)
                + "/likes", null, HttpMethod.POST,
        new Request.Callback() {

            @Override
            public void onCompleted(Response response) {
                // Request complete
                if (response.getError() == null) {
                    UnlockRequestToServer unlockRequestToServer = new UnlockRequestToServer(
                            mOffersListActivity,
                            PublicMacros.TYPE_UNLOCK_FB_LIKE,
                            currentOffer.postId);

                } else {
                    final String errorMsg = "error: "
                            + response.getError()
                                    .toString();
                    Log.e(MyLogger.TAG, errorMsg);
                    if (BaseApplication
                            .getCurrentActivity() != null) {
                        BaseApplication
                                .getCurrentActivity()
                                .runOnUiThread(
                                        new Runnable() {
                                            public void run() {
                                                if (PublicMacros.DEBUG) {
                                                    Toast.makeText(
                                                            BaseApplication
                                                                    .getCurrentActivity(),
                                                            errorMsg,
                                                            Toast.LENGTH_LONG)
                                                            .show();
                                                }
                                            }
                                        });
                    }
                }
                String re = response.toString();
            }
        });
request.executeAsync();

Does someone know how long is postId valid for FB like action ?

VVB
  • 7,363
  • 7
  • 49
  • 83
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
  • are you able to access other things using same post_id? – VVB Aug 19 '14 at 12:53
  • Does the 'like' get registered on the post in question before AND after the message? – jbutler483 Aug 20 '14 at 11:46
  • In my application I have checked the Session.getActiveSession.getstate().isopen which returns true or false and in case of false i try to get the active session and post the pic or status. – Faraz Ahmed Aug 23 '14 at 10:27
  • I renew the session but i save an oldPostId to which I want to do a "like". so when is it too old I get exception: FB cannot find this postId. The q is how long is this time? – Elad Benda Aug 23 '14 at 14:26

1 Answers1

0

How do I get a page Access Token that does not expire? May contain some useful iformaion for you.

Facebook 3.0 How to post wall? Shows you how to post to your wall

This Question shows you the 'like' Facebook like in android using android.

EDIT

Facebook doesn't notify you that a previously issued access token has become invalid. Unless you have persisted the expiry time passed to your App along with the access token, your app may only learn that a given token has become invalid is when you attempt to make a request to the API. Also, in response to certain events that are security-related, access tokens may be invalidated before the expected expiration time.

Community
  • 1
  • 1
jbutler483
  • 24,074
  • 9
  • 92
  • 145
  • please help me with the exact question. I was asking about expiration time. You have posted many links from FB doc, but didn't answered my question – Elad Benda2 Aug 19 '14 at 17:26
  • this post explains a LOT to do with your question: https://developers.facebook.com/docs/facebook-login/access-tokens#errors – jbutler483 Aug 20 '14 at 11:48