我知道有很多关于 Facebook 的问题,但我找不到能回答我问题的问题。基本上我想做的是获取一个整数,表示 Java 中有多少通知、收件箱、好友请求。有谁知道如何或可以提供可以回答我的问题的链接吗?
如有任何帮助,我们将不胜感激。
我建议使用像 http://restfb.com/ 或 http://facebook4j.org/ 这样的库来从 Java 应用程序与 Facebook API 进行对话。
使用 RestFB,它看起来像下面这样:
FacebookClient publicOnlyFacebookClient = new DefaultFacebookClient();
Connection<Notification> notifications =
facebookClient.fetchConnection("me/notifications", Notification.class,
Parameter.with("fields","title"));
通过notifications.getData(),您可以访问通知并可以对它们进行计数。