앱에 Play 게임즈 서비스 리콜 통합

자체 계정 시스템을 계속 사용하는 동안 사용자를 게임에 원활하게 로그인합니다. Play 게임즈 서비스 리콜 API를 사용하면 게임 내 계정을 Google Play 게임즈 서비스 계정과 연결할 수 있습니다. 그런 다음 사용자가 여러 기기에서 게임을 플레이하거나 (또는 게임을 재설치한 후 동일한 기기에서 게임을 플레이) 연결된 게임 내 계정을 쿼리하고 로그인 흐름을 간소화할 수 있습니다.

Android Recall API와 통합한 경우 이러한 Recall API가 익숙할 것입니다. Play 게임즈 서비스 리콜과의 모든 서버 측 통합은 Android와 PC에서 동일하므로 PC 타이틀에서 재사용할 수 있습니다.

기본 요건

1단계: 매니페스트에 Play 게임즈 서비스 프로젝트 ID 추가

Play Console에서 Play 게임즈 서비스 설정을 완료하면 게임에 연결된 Play 게임즈 서비스 프로젝트 ID가 생성됩니다. Play Console의 Play 게임즈 서비스 구성 페이지에서 찾을 수 있는 이 프로젝트 ID를 사용하여 게임의 manifest.xml를 업데이트합니다.

manifest.xml 콘텐츠 예시:

<?xml version="1.0" encoding="utf-8"?>
<Manifest version="1">
    <Application>
        <PackageName>com.example.package</PackageName>
        <PlayGamesServices>
            <ProjectId>123456789</ProjectId>
        </PlayGamesServices>
    </Application>
</Manifest>

2단계: 로그인 시 리콜 액세스 요청

게임에서 로그인 과정을 처리하는 경우(예: 게임 내 계정 추가) GamesRecallClient::RequestRecallAccess()를 사용하여 리콜 액세스를 요청합니다.

이 호출은 백엔드에서 Play 게임즈 서비스 사용자와 게임 내 계정을 연결 및 연결 해제하기 위해 Google에 서버 측 호출을 실행하는 데 사용하는 세션 ID를 반환합니다.

auto promise = std::make_shared<std::promise<RecallAccessResult>>();
games_recall_client.RequestRecallAccess(params, [promise](RecallAccessResult result) {
   promise->set_value(std::move(result));
});

auto recall_access_result = promise->get_future().get();
if (recall_access_result.ok()) {
   auto recall_session_id = recall_access_result.value().recall_session_id;
   // Pass the recall session ID to your backend game server so it can query
   // for an existing linked in-game account.
   // - If you discover an existing linked in-game account, continue to sign-in
   //   the in-game account. This provides a seamless cross-device sign-in
   //   experience.
   // - If there is not an existing linked in-game account, when the user
   //   completes the sign-in using your in-game account system record the
   //   account linking with Play Games Services Recall. This helps to provide
   //   a seamless cross-device sign-in experience when the user returns on a
   //   different device or after re-installing your game on the same device.
} else {
   // Handle the error
}

3단계: 리콜 세션 ID 처리

게임에 리콜 세션 ID가 있고 이를 백엔드 게임 서버에 전달한 후에는 Play 게임즈 서버 측 REST API를 사용하여 다음 작업을 실행합니다.

서버 측 통합에 관한 자세한 가이드는 게임 서버 내에서 Recall API를 사용하는 방법을 다루는 문서를 참고하세요.