마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 - 구글 플레이 서비스 연동하기 질문

0 추천

프로그래밍 시작한지 2달되가는 초보입니다.

 

만들고있는 앱이 있는데 구글플레이 서비스 연동해서 점수등록이 가능하도록 하고있습니다.

 

 

https://developers.google.com/games/services/android/init 

 

이 가이드보고 무작정 따라하고있는데요.

 

첨부 이미지

 

앱을 키면 플레이 접속중 녹색 팝업 뜨고 로딩 돌아가다가 이 팝업이 뜹니다.

 

1. 인터넷은 당연히 연결되어있고

2. 인터넷 사용권한도 manifest에 추가되어있고

 

3. 이게 서비스 연동 관련된 코드

https://stackoverflow.com/questions/45498159/android-connecting-to-google-play-service-api?noredirect=1#comment77965122_45498159 

 

4. 메니페스트에 이거 추가했고
 

<meta-data
   android:name="com.google.android.gms.games.APP_ID"
   android:value="@string/app_id" />
<meta-data
  android:name="com.google.android.gms.version"
   android:value="@integer/google_play_services_version" />


5.image

 

개발자 콘솔에 플레이 게임도 추가되어있고

 

6.image

image

 

image

 

ids.xml에 리더보드랑 아이디도 넣었고

 

가이드에 나온건 다 따라한거같은데 왜 연결 실패가 나올까요.

메시지창에도 로그찍히는게 없어서 가뜩이나 무작정 따라하는 코드인데

어디에 문제가 있는지도 감이 안잡힙니다.

 

protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == RC_SIGN_IN) {
        mSignInClicked = false;
        mResolvingConnectionFailure = false;
        if (resultCode == RESULT_OK) {
            mGoogleApiClient.connect();
        } else {
System.out.println(resultCode+" + "+RESULT_OK);
            // Bring up an error dialog to alert the user that sign-in
            // failed. The R.string.signin_failure should reference an error
            // string in your strings.xml file that tells the user they
            // could not be signed in, such as "Unable to sign in."
            BaseGameUtils.showActivityResultError(this,requestCode, resultCode, R.string.signin_failure);
        }
    }
}

 

알아보다가 여기서 메시지가 뜨는걸 알아냈는데 resultCode가 10002가 나옵니다.

 

그게 무슨뜻이죠?

 

갈피를 못잡아서 답답한데 주변에 안드로이드는 커녕 자바를 아는 사람도 없어서 여기를 찾아왔습니다.

익명사용자 님이 2017년 8월 10일 질문
2017년 8월 10일 수정

1개의 답변

0 추천

https://developers.google.com/android/reference/com/google/android/gms/games/GamesActivityResultCodes.html#RESULT_SIGN_IN_FAILED

public static final int RESULT_SIGN_IN_FAILED

Result code sent back to the calling Activity when signing in fails.

The attempt to sign in to the Games service failed. For example, this might happen if the network is flaky, or the user's account has been disabled, or consent could not be obtained. Constant Value: 10002

aucd29 (218,390 포인트) 님이 2017년 8월 11일 답변
...