retrieving the user facebook information on my android application
I've integrated facebook in my android application using facebook sdk
and succeded to do a login from my app.Next I wanna retrieve on my android application all this user's personal information(Info).But I haven't found any tutorials on that, yet.Can someone give me a hint of how I should proceed?Thank you:)
EDIT: As I understand from there this is the way how the requests for friends/user information should be done. But there is something I don't understand....Is this method called automaticaly after I logg in?????
Bundle params = new Bundle();
String accessToken = facebook.getAccessToken();
try
{
params.putString("format", "json");
params.putString("access_token", accessToken);
String url = "https://graph.facebook.com/"+Id;
......
}
This is the way I logg in:
tweet.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
postMessage();
}
});
I have a button
tweet
and a listener that calls for my method that looks like this:
public void postMessage() {
if (facebookConnector.getFacebook().isSessionValid()) {
postMessageInThread();
开发者_Go百科 } else {
SessionEvents.AuthListener listener = new SessionEvents.AuthListener() {
@Override
public void onAuthSucceed() {
postMessageInThread();
}
@Override
public void onAuthFail(String error) {
}
};
SessionEvents.addAuthListener(listener);
facebookConnector.login();
}
}
Question:First I definitly have to logg in and after that to retrieve the information/friends list and so on.....but where should I call for this methods??This is extremly unclear to me....are they called automaticaly after I logg in?
You have to call the Graph API on Facebook, it'll return JSON to you with the infos you need
Read the paragraph called "Calling the graph API" here : http://developers.facebook.com/docs/guides/mobile/#android and follow the links
精彩评论