San*_*ani 5 android facebook facebook-graph-api android-facebook facebook-share
当用户设置特定的预定时间时,我需要在页面上自动发布.我尝试使用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();
Run Code Online (Sandbox Code Playgroud)
但它给出了以下回应.
{"error": {"message": "(#100) The specified scheduled publish time is invalid.",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "HcuHy8cusGC"}}
Run Code Online (Sandbox Code Playgroud)
您必须以秒为单位设置 Unix 时间戳。以下方法将当前毫秒转换为 Unix 秒
Long unixsecond=Calendar.getInstance().getTimeInMillis()/1000L;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
107 次 |
| 最近记录: |