当用户设置特定的预定时间时,我需要在页面上自动发布.
我尝试使用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秒
原文链接:https://www.f2er.com/android/430105.htmlLong unixsecond=Calendar.getInstance().getTimeInMillis()/1000L;