【问题标题】:"GoogleApiClient has an optional Plus.API and is not connected to Plus"“GoogleApiClient 有一个可选的 Plus.API 并且未连接到 Plus”
【发布时间】:2017-07-03 14:35:24
【问题描述】:

我正在为我的 android 应用程序使用谷歌登录,最近我收到运行时异常报告错误“GoogleApiClient 有一个可选的 Plus.API 并且未连接到 Plus。使用 GoogleApiClient.hasConnectedApi(Plus .API) 来保护这个调用。"

【问题讨论】:

    标签: android google-api-client runtimeexception google-plus-signin


    【解决方案1】:

    在从谷歌登录获得的活动结果中使用这个

    if (mGoogleApiClient.hasConnectedApi(Plus.API)) {
                Person person  = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
                if (person != null) {
                    //Take the required action 
                    Log.i(TAG, "Display Name: " + person.getDisplayName());
                    Log.i(TAG, "Gender: " + person.getGender());
                    Log.i(TAG, "About Me: " + person.getAboutMe());
                    Log.i(TAG, "Birthday: " + person.getBirthday());
                    Log.i(TAG, "Current Location: " + person.getCurrentLocation());
                    Log.i(TAG, "Language: " + person.getLanguage());
                } else {
                    Log.e(TAG, "Error!");
                }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多