Question

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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top