[英]Get UserName when login with Facebook using SDK 3.15 in Android
Today I was trying to implement the new Facebook sdk v3.15.0 and I had a problem with retrieving username after getting GraphUser
object.今天我正在尝试实施新的 Facebook sdk v3.15.0,但在获取
GraphUser
对象后检索用户名时遇到了问题。
Before implementing the new Facebook SDK I was using facebook-android-sdk-3.7
and I managed to receive username, here i will post my GraphUser object:在实施新的 Facebook SDK 之前,我使用了
facebook-android-sdk-3.7
并且我设法收到了用户名,在这里我将发布我的 GraphUser 对象:
GraphObject{graphObjectClass=GraphUser, state={"id":"10000*******","first_name":"****","username":"him.her","timezone":2,"email":"ultimo****@yahoo.com","verified":true,"name":"*** D**a","locale":"en_US","link":"https:\/\/www.facebook.com\/k***o.d****","last_name":"D****a","gender":"male","updated_time":"2014-03-03T10:10:54+0000"}}
When I implemented the new Facebook SDK, the GraphUser object that I received was this:当我实现新的 Facebook SDK 时,我收到的 GraphUser 对象是这样的:
GraphObject{graphObjectClass=GraphUser, state={"id":"153****","first_name":"***i","timezone":2,"email":"ol***@yahoo.it","verified":true,"name":"O*** S***","locale":"en_US","link":"http:\/\/www.facebook.com\/1*****","last_name":"****e","gender":"male","updated_time":"2014-04-22T19:59:34+0000"}
I use this to get the GraphUser:我用它来获取 GraphUser:
......
@Override
public void onUserInfoFetched(GraphUser user) { ....
Problem问题
How can I get the username when I log in with Facebook with the new SDK?使用新 SDK 登录 Facebook 时如何获取用户名?
The username
field is no longer available with the Graph API v2.0. Graph API v2.0 不再提供
username
名字段。 Have a look at my answer here: Omniauth-facebook hash not showing Facebook 'username' field, using rails 3在这里看看我的回答: Omniauth-facebook hash not show Facebook 'username' field, using rails 3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.