私のアプリケーションでは、すべての友達の壁に投稿する必要があります。これを行うには、次のコードを使用しました。
final int postCount = friends_facebookids.size();
new Timer().schedule(new TimerTask() {
@Override
public void run() {
if(postCount==0){
Toast.makeText(getApplicationContext(), "Add friends to post", Toast.LENGTH_SHORT).show();
}
for(int m=0;m<friends_facebookids.size();m++){
String res= UrltoValue.getValuefromUrl("https://graph.facebook.com/"+friends_facebookids.get(m)+"/feed?access_token="+accesstoken+"&method="+"post"+"&message="+strFullMessage.replaceAll(" ", "%20")+"&source="+imageUrl);
Log.e("post response",res);
counter +=1;
}
if(counter>=postCount){
cancel();//stops the timer
counter=0;
}
}
}, 1000,3000);
ここでは、Facebook からの制限なしに複数の友達のウォールに投稿できるように、各リクエスト間に 3 秒の遅延を与えています。
25 人の友人まではうまくいきましたが、その後は (Bad Request as Response) を取得しています。コードを変更する必要はありますか? Facebook に 25 回投稿した後、見習い制限があるのはなぜですか。