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

时间:2017-02-21 09:58:31

标签: android facebook facebook-graph-api android-facebook facebook-share

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

Composer could not find a composer.json file in /var/www/html

但它给出了以下回应。

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

1 个答案:

答案 0 :(得分:3)

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

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