Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to post update on Facebook page automatically by given scheduled time ? using android

I need to automatically post on page when user set specific scheduled time. I have try using Graph api with below request:

    Bundle params1 = new Bundle();
    params1.putString("message", "This is a system generated post");
    params1.putString("scheduled_publish_time",(date.getTime()+(1000*60*30))""); //for current time to next 30 min
    params1.putBoolean("published", false);
    new GraphRequest(
            accessToken,
            "/850285671748182/feed",               
            params1,
            HttpMethod.POST,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
        /* handle the result */
                    Log.d("Response-auto", "DATA" + response);

                }
            }
    ).executeAsync();

But it give below response.

{"error": {"message": "(#100) The specified scheduled publish time is invalid.",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "HcuHy8cusGC"}}
like image 422
Sanjay Bhalani Avatar asked Oct 17 '22 16:10

Sanjay Bhalani


1 Answers

You must to set up Unix TimeStamp in seconds.Below way to convert your current milliseconds into Unix Second

Long unixsecond=Calendar.getInstance().getTimeInMillis()/1000L;
like image 173
Sanjay Bhalani Avatar answered Oct 21 '22 06:10

Sanjay Bhalani