Anu*_*pam 11 android facebook facebook-android-sdk
我正在开发一个应用程序,我正在使用FacebookSDK中的登录按钮.我能够得到access_token用户,但我也想要userID.我几乎尝试了一切,但没有成功.我使用facebook教程来实现这一目标.这是链接:Facebook登录按钮
请帮我userID从相同的登录按钮获取.
任何形式的帮助将不胜感激.
Dee*_*ika 11
使用FB Profile类的getId方法(Facebook SDK 4.0).
Profile profile = Profile.getCurrentProfile();
System.out.println(profile.getFirstName());
System.out.println(profile.getId());
Run Code Online (Sandbox Code Playgroud)
登录成功后,需要调用以下代码。您可以通过响应中的 id 获取登录用户的详细信息。
Session session = Session.getActiveSession();
Request request = Request.newGraphPathRequest(session, "me", null);
com.facebook.Response response = Request.executeAndWait(request)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
40071 次 |
| 最近记录: |