I need to automatically post on page when user set specific scheduled time. I have try using Graph api with below request:
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();
But it give below response.
{"error": {"message": "(#100) The specified scheduled publish time is invalid.",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "HcuHy8cusGC"}}
You must to set up Unix TimeStamp in seconds.Below way to convert your current milliseconds into Unix Second
Long unixsecond=Calendar.getInstance().getTimeInMillis()/1000L;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With