独自のアカウント システムを引き続き使用しながら、ユーザーをゲームにシームレスにログインさせます。Play Games Services Recall API を使用すると、ゲーム内アカウントを Google Play Games サービス アカウントにリンクできます。これにより、ユーザーが異なるデバイス(またはゲームを再インストールした後の同じデバイス)でゲームをプレイするときに、リンクされたゲーム内アカウントをクエリし、ログインフローを効率化できます。
Android Recall API を統合している場合は、これらの Recall API は使い慣れているはずです。Android と PC の両方で同じであるため、Play Games サービス リコールとのサーバーサイド統合は、PC タイトルで再利用できます。
ステップ 1: マニフェストに Play Games 開発者サービスのプロジェクト ID を追加する
Google Play Console で Play ゲームサービスの設定を完了すると、ゲームに Play ゲームサービスのプロジェクト ID が関連付けられます。このプロジェクト ID(Google Play Console の Play Games サービスの [設定] ページで確認できます)を使用して、ゲームの manifest.xml を更新します。
この呼び出しは、バックエンドで Google に対してサーバーサイド呼び出しを行い、ゲーム内アカウントと Play Games サービス ユーザーのリンクとリンク解除を行うために使用されるセッション ID を返します。
autopromise=std::make_shared<std::promise<RecallAccessResult>>();games_recall_client.RequestRecallAccess(params,[promise](RecallAccessResultresult){promise->set_value(std::move(result));});autorecall_access_result=promise->get_future().get();if(recall_access_result.ok()){autorecall_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}
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-26 UTC。"],[],[],null,["# Integrate the Play Games Services Recall into your app\n\nSeamlessly sign users into your game while continuing to use your own account\nsystem. With Play Games Services Recall APIs you can link in-game accounts with\na Google Play Games Services account, then when a user plays your game across\ndifferent devices (or the same device after re-installing your game) you query\nthe linked in-game account and streamline the sign-in flow.\n\nIf you have integrated with the [Android Recall APIs](/games/pgs/recall/recall-setup), these\nRecall APIs should look familiar. Any server-side integrations with Play Games\nServices Recall can be reused by PC titles as they are the same across both\nAndroid \\& PC.\n\nPrerequisites\n-------------\n\n- Complete the [SDK setup](/games/playgames/native-pc/setup).\n\n- Read the overview of [Play Games Services Recall API](/games/pgs/recall).\n\n- Complete [Google Play Games Services setup](/games/pgs/console/setup) in the Play Console.\n\n**Step 1**: Add your Play Games Services project ID in the manifest\n-------------------------------------------------------------------\n\nAfter completing the Play Games Services setup in the Play Console, your game\nnow has an associated Play Games Services' project ID. Using this project ID,\nwhich can be found inside Play Games Service's\n[Configuration page](https://play.google.com/console/u/0/developers/app/games/configuration-summary) in the Play Console, update\nyour game's `manifest.xml`.\n\nExample `manifest.xml` contents: \n\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cManifest version=\"1\"\u003e\n \u003cApplication\u003e\n \u003cPackageName\u003e\u003cvar translate=\"no\"\u003ecom.example.package\u003c/var\u003e\u003c/PackageName\u003e\n \\\u003cPlayGamesServices\\\u003e\n \\\u003cProjectId\\\u003e\u003cvar translate=\"no\"\u003e123456789\u003c/var\u003e\\\u003c/ProjectId\\\u003e\n \\\u003c/PlayGamesServices\\\u003e\n \u003c/Application\u003e\n \u003c/Manifest\u003e\n\n**Step 2**: Request Recall access when signing-in\n-------------------------------------------------\n\n| **Tip:** We recommend using the Recall API to query for linked in-game accounts each time your game is launched. For new installs a linked in-game account can be used to seamlessly sign-in a user and restore their progress. For existing installs, when the linked in-game account changes it signals that the user switched accounts on a different device and you can save them time by switching to that account.\n\nWhen your game is handling a sign-in flow, for example adding an in-game\naccount, request Recall access using\n[`GamesRecallClient::RequestRecallAccess()`](/games/playgames/native-pc/reference/class/google/play/games/recall/games-recall-client#requestrecallaccess).\n\nThis call returns a session ID which is used by your backend to make server-side\ncalls to Google for linking \\& unlinking your in-game accounts with a Play Games\nServices user. \n\n auto promise = std::make_shared\u003cstd::promise\u003cRecallAccessResult\u003e\u003e();\n games_recall_client.RequestRecallAccess(params, [promise](RecallAccessResult result) {\n promise-\u003eset_value(std::move(result));\n });\n\n auto recall_access_result = promise-\u003eget_future().get();\n if (recall_access_result.ok()) {\n auto recall_session_id = recall_access_result.value().recall_session_id;\n // Pass the recall session ID to your backend game server so it can query\n // for an existing linked in-game account.\n // - If you discover an existing linked in-game account, continue to sign-in\n // the in-game account. This provides a seamless cross-device sign-in\n // experience.\n // - If there is not an existing linked in-game account, when the user\n // completes the sign-in using your in-game account system record the\n // account linking with Play Games Services Recall. This helps to provide\n // a seamless cross-device sign-in experience when the user returns on a\n // different device or after re-installing your game on the same device.\n } else {\n // Handle the error\n }\n\n**Step 3**: Process the Recall session ID\n-----------------------------------------\n\nOnce your game has the Recall session ID and has passed it to you backend game\nserver, use the [Play Games server-side REST APIs](/games/services/web/api/rest/v1/recall) to:\n\n- Querying for existing linked in-game accounts using [`recall.retrieveTokens`](/games/services/web/api/rest/v1/recall/retrieveTokens)\n- Add or update linked in-game accounts using [`recall.linkPersona`](/games/services/web/api/rest/v1/recall/linkPersona)\n- Delete linked in-game accounts using [`recall.unlinkPersona`](/games/services/web/api/rest/v1/recall/unlinkPersona)\n\nFor a more detailed guide covering the server-side integration see the\ndocumentation covering how to\n[use the Recall API within your game server](/games/pgs/recall/recall-setup#using-recall)."]]