如何 post 在给定的预定时间自动更新 Facebook 页面?使用 android

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

当用户设置特定的预定时间时,我需要在页面上自动 post。 我尝试在以下请求中使用 Graph api:

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

但它给出了以下响应。

{"error": {"message": "(#100) The specified scheduled publish time is invalid.",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "HcuHy8cusGC"}}

您必须以 seconds.Below 方式设置 Unix TimeStamp 以将您当前的毫秒数转换为 Unix 秒数

Long unixsecond=Calendar.getInstance().getTimeInMillis()/1000L;