2016-08-01 73 views
1

谷歌登錄工作正常,然後上傳到商店,但上傳應用程序到商店後,谷歌登錄不起作用,並且在handleSignInResult()中始終返回false。方法。谷歌登錄後上傳應用程序無法正常工作店鋪

下面是使用代碼:

try { 
     GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) 
       // .requestEmail() 
       .requestIdToken(getString(R.string.server_client_id)) 
       .requestEmail() 
       // .requestScopes(new Scope(Scopes.DRIVE_APPFOLDER)) 
       // .requestServerAuthCode(getString(R.string.server_client_id), false) 
       .build(); 
     mGoogleApiClient = new GoogleApiClient.Builder(getActivity()) 
       .enableAutoManage(getActivity() /* FragmentActivity */, this /* OnConnectionFailedListener */) 
       .addApi(Auth.GOOGLE_SIGN_IN_API, gso) 
       .build(); 
    } catch (IllegalStateException e) { 
     Log.e("IllegalStateException ", e.toString()); 
    } 

@Override 
public void onActivityResult(int requestCode, int resultCode, Intent data) { 
    super.onActivityResult(requestCode, resultCode, data); 


    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); 
    if (requestCode == RC_GET_TOKEN) { 
     GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); 
     handleSignInResult(result); 
    } 


} 
    private void handleSignInResult(GoogleSignInResult result) { 
    Log.d(TAG, "handleSignInResult:" + result.isSuccess()); 
    if (result.isSuccess()) { 
     // Signed in successfully, show authenticated UI. 
     GoogleSignInAccount acct = result.getSignInAccount(); 
} 
+0

是否可以使用調試密鑰進行測試,而不是使用釋放密鑰進行測試? –

+1

Api Key for release apk與衆不同,所以在google開發者控制檯更新你的api key – Arshak

+0

好的。謝謝我使用了發行版SHA1 Key。 –

回答

相關問題