android Google+ 将用户生日年份返回为 0000

标签 android google-plus

我在我的应用程序中使用 Google+ 进行用户登录和在用户墙上发帖。

在用户墙上发帖效果很好。

但是当我尝试获取用户个人资料数据时,它会将用户生日年份返回为 0000。这只发生在某些用户和其他用户身上,我得到了正确的生日。

我有以下代码来初始化 Google+ 客户端

mPlusClient = new PlusClient.Builder(getApplicationContext(), this, this)
                    .setVisibleActivities("http://schemas.google.com/AddActivity").setScopes(Scopes.PLUS_LOGIN, Scopes.PLUS_PROFILE).build();

我有以下代码来检索用户个人资料数据:

mPlusClient.loadPerson(this, "me");
@Override
    public void onPersonLoaded(ConnectionResult arg0, Person arg1)
        {
            Log.i("Person",""+arg1.toString());

           if (currentperson.hasBirthday())
                            {
                                String Birthday = currentperson.getBirthday();
                                MyLog.i("Birthdate :", "" + Birthday);
                            }
            }

为什么会这样? 为什么它只发生在某些用户身上? 我错过了什么吗?

请帮帮我。

最佳答案

用户可以在他们的个人资料设置中决定他们是否要公开他们的生日(这是您唯一会得到的生日)以及他们是否要包括年份的附加设置。禁用此设置后,您将获得 0000 作为年份而不是实际年份。

Birthday settings

关于android Google+ 将用户生日年份返回为 0000,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17783971/

相关文章:

Android:图库 View 已被弃用?

android - 如何使用自己的对象和枚举来分割类

javascript - 谷歌登录: Disable automatic authentication

ios - 我可以在没有任何对话 View 的情况下从我的 iOS 应用程序将一些内容分享到 Google+ 吗?

java - TextToSpeech 停止()不工作

java - 如何使用 MediaPlayer 获取流媒体比特率?

android - Android 2.2 HTTP progressive streaming = HTTP Live Streaming?

ios - 没有登录的谷歌共享不起作用

android - Xamarin Android Google 登录 OnConnected 回调从未抛出

android - 如何在 Java 中单击按钮时在我的 Android 应用程序中注销 Google 用户?