2016-07-21 4 views
-1

설명서를 살펴본 후 온라인에서 몇 가지 자습서를 검색 한 다음 BaseGameActivity.java과 다른 사람을 사용하지 않고 지금보다 더 혼란스럽지 않은 곳을 보았습니다. 그래서 누군가가 나에게 일을 명확히하기를 바라는 내 질문을 나열 할 것입니다. (문서 링크만으로 응답하지 마십시오).Google Play 게임 로그인을 설정하려면 어떻게해야하나요?

내가 필요한 것은 플레이어가 처음 시작할 때 자동으로 로그인하는 것입니다.

1) 내 게임을 게시해야하거나 어딘가에 ID를 삽입해야합니까? (내 게임이 게시 될 준비가 된 개발자 콘솔에 있습니다.)

2) 로그인 기능을 위해 작성해야하는 실제 코드는 무엇입니까?

답변

0

Google Play Games Services docs에 이미 지정된 단계를 따르십시오. 2. Google에 게임을 추가 Google에

1 단계 로그인 Play 개발자 콘솔

단계 Play 개발자 콘솔

3 단계 생성의 OAuth 2.0 클라이언트 ID

확인 GPGS Android Samples in Github도 마찬가지입니다.

로그인 기능을 위해 작성해야하는 실제 코드는 무엇입니까?

private static int RC_SIGN_IN = 9001; 
private boolean mResolvingConnectionFailure = false; 
private boolean mAutoStartSignInflow = true; 
private boolean mSignInClicked = false; 

// ... 

@Override 
public void onConnectionFailed(ConnectionResult connectionResult) { 
    if (mResolvingConnectionFailure) { 
     // Already resolving 
     return; 
    } 

    // If the sign in button was clicked or if auto sign-in is enabled, 
    // launch the sign-in flow 
    if (mSignInClicked || mAutoStartSignInFlow) { 
     mAutoStartSignInFlow = false; 
     mSignInClicked = false; 
     mResolvingConnectionFailure = true; 

     // Attempt to resolve the connection failure using BaseGameUtils. 
     // The R.string.signin_other_error value should reference a generic 
     // error string in your strings.xml file, such as "There was 
     // an issue with sign in, please try again later." 
     if (!BaseGameUtils.resolveConnectionFailure(this, 
       mGoogleApiClient, connectionResult, 
       RC_SIGN_IN, R.string.signin_other_error)) { 
      mResolvingConnectionFailure = false; 
     } 
    } 

    // Put code here to display the sign-in button 
} 
+0

내가이 오류 받고 있어요 방법 Implement Sign-in 귀하의 안드로이드 게임에서

: –

+0

java.lang.NoSuchMethodError : 없음 직접적인 방법을. 메인 클래스를 가리키며, mGoogleApiClient.connect(); ~이다. –

관련 문제