gpt4 book ai didi

android - Plus.PeopleApi.getCurrentPerson 返回 null

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:02:25 25 4
gpt4 key购买 nike

我目前正在开发我的应用中的 Google Plus 登录功能。

我像下面这样创建了 GoogleApiClient 构建器

Plus.PlusOptions options = new Plus.PlusOptions.Builder()
.addActivityTypes("http://schemas.google.com/AddActivity")
.build();

myGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
// .addApi(Plus.API, Plus.PlusOptions.builder().build())
.addApi(Plus.API, options)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.addScope(Plus.SCOPE_PLUS_PROFILE).build();

还有onConnected方法

@Override
public void onConnected(Bundle arg0) {
// TODO Auto-generated method stub

plusUtilities.ShowToast("Login successful");

updateGPbutton();
// hide progress DiaLog
plusUtilities.DissmissPD();
// it has deprecated
// plusUtilities.ShowToast("Login to Google+ with " +
// mPlusClient.getAccountName().toString());

// upgraded class
plusUtilities.ShowToast("Login to Google+ with "
+ Plus.AccountApi.getAccountName(myGoogleApiClient).toString());

// deprecated
// mPlusClient.loadPeople(this, "me");

Plus.PeopleApi.load(myGoogleApiClient, "me");
// plusUtilities.ShowPD("Fetching user data... ");

// upgraded and call fetch_user_details method here instead of calling
// in onPersonLoad() override method
Log.d("Googleplusclient",
"" + Plus.PeopleApi.getCurrentPerson(myGoogleApiClient));
Plus.PeopleApi.loadVisible(myGoogleApiClient, null).setResultCallback(this);

if (Plus.PeopleApi.getCurrentPerson(myGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi
.getCurrentPerson(myGoogleApiClient);
fetch_User_Details(currentPerson);
}

}

下面的方法返回null

Plus.PeopleApi.getCurrentPerson(myGoogleApiClient)

我关注了 the link解决方案。然后我跟着这个developer link也。直到我得到空值。

如何解决?

最佳答案

问题是,您的 DEBUG sha1 签名与您的 customkey.keystore sha1 签名不同!!!!所以你应该找到你的调试 sha1 签名并在谷歌控制台上的 API 凭据上创建该 key ASWELL! :D 这有效并修复了相信我,检查你的 api 控制台,我敢打赌你的 api 请求是 0?

关于android - Plus.PeopleApi.getCurrentPerson 返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27191583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com