0
我已經做了在這個問題上我的研究......所有關於這一主題的其他職位,我仍然堅持。。 isSuccess()始終返回false
我的應用程序的版本註冊爲調試版本....所以不需要創建簽名APK?
我已經確信,我從web應用使用客戶ID,而不是從項目的Android版本。
我在谷歌控制檯上設置我的應用程序時使用了一個SHA-1。
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestServerAuthCode("/*client_id goes in here*/")
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this
/* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.addApi(AppIndex.API).build();
這部分代碼在我的onCreate方法去。
下便在我onActivityResult處理器。
GOOGLE_SIGN_IN常數預定義。
if (requestCode == GOOGLE_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
Toast.makeText(LoginActivity.this, "Google Login Details:" + result.getStatus().toString(), Toast.LENGTH_LONG).show();
handleSignInResult(result);
}
最後一部分是在結果處理我谷歌的標誌。
private void handleSignInResult(GoogleSignInResult result) {
if (result.isSuccess()) {
GoogleSignInAccount acct = result.getSignInAccount();
Toast.makeText(getApplicationContext(),"Welcome "+acct.getDisplayName(),Toast.LENGTH_SHORT).show();
Intent MainActivity = new Intent(getApplicationContext(), MainActivity.class);
startActivity(MainActivity);
} else {
Toast.makeText(LoginActivity.this, "Login Cancel", Toast.LENGTH_LONG).show();
}
}
所有其他用於使Google登錄API工作的代碼與文檔中的代碼相同。
result.getStatus()方法在活動處理程序does not顯示通常的12050錯誤,這將指示配置問題。相反,它說的StatusCode =開發商,分辨率= NULL
任何幫助將非常感激。
此外,沒有錯誤或適應症的問題是在我的logcat什麼.... – SeanMcDonagh