当用户设置特定的计划时间时,我需要自动在页面上发帖。
我尝试将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"}}

最佳答案

您必须以秒为单位设置Unix TimeStamp。以下将当前毫秒转换为Unix Second的方法

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

10-08 17:29