I know there are quite a few questions about Facebook but I couldn't find one which answered my question. Basically what i'm trying to do is get an integer for how many notifications, inboxes, friend requests in Java. Does anyone know how to or can provide a link to something which will answer my question? Any help is appreciated, thanks.

有帮助吗?

解决方案

I would suggest using a library like http://restfb.com/ or http://facebook4j.org/ to talk to the Facebook API from your Java application.

With RestFB it would look something like the following:

FacebookClient publicOnlyFacebookClient = new DefaultFacebookClient();
Connection<Notification> notifications = 
facebookClient.fetchConnection("me/notifications", Notification.class, 
Parameter.with("fields","title")); 

Via notifications.getData() you have access to the notifications and can count them.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top