如何使用Facebook的登录按钮在Android应用程序获取FB用户ID [英] How to get FB User ID using Facebook Login Button in android application

查看:283
本文介绍了如何使用Facebook的登录按钮在Android应用程序获取FB用户ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发中,我使用的Facebook 登录从SDK按钮的应用程序。我能够获得 access_token 用户,但我想用户ID 太。我已经试过几乎所有的东西,但没有成功。我已经使用Facebook的教程实现这一点。这里是链接: Facebook的登录按钮

I'm developing an application in which I'm using Facebook log in button from SDK. I'm able to get access_token of the user but I want userID too. I have tried almost everything but was not successful. I have used facebook tutorial for achieving that. Here is the link: Facebook Login Button

请帮我在获得用户ID 从相同的登录按钮。

Please help me in getting userID from the same login button.

任何形式的帮助将是AP preciated。

Any kind of help will be appreciated.

推荐答案

登录成功后,你需要调用以下code。你可以得到响应与ID登录的用户的详细信息。

After successful login, you need to call following code. You can get the logged-in user details with id in response.

Session session = Session.getActiveSession();
Request request = Request.newGraphPathRequest(session, "me", null);
com.facebook.Response response = Request.executeAndWait(request)

这篇关于如何使用Facebook的登录按钮在Android应用程序获取FB用户ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆