تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تتيح واجهة برمجة التطبيقات Recall API للألعاب إدارة الروابط بين مستخدمي "خدمات ألعاب Google Play" (PGS) و
حساباتهم داخل اللعبة من خلال تخزين الرموز المميّزة لإعادة التذكير على خوادم Google. في ما يلي مثال على أحد سيناريوهات استخدام واجهة برمجة التطبيقات Recall API.
يلعب أحد المستخدمين لعبة يستخدم فيها المطوِّر نظامًا للهوية لتتبُّع
مستوى تقدّم المستخدم، ويستخدم "خدمات ألعاب Play" إلى جانب طرق مصادقة أخرى لتسجيل
مستخدميه في لعبته. في هذا المثال، سجّل مستخدم الدخول إلى حسابه على PGS
Laura، وأنشأ حسابًا داخل اللعبة باستخدام نظام هوية المطوّر المسمى Racer94. بينما يلعب المستخدم اللعبة، تتم مزامنة مستوى تقدّمه على
خادم اللعبة الخاص بالمطوّر.
يحفظ المطوّر بشكل منفصل رمزًا مميّزًا لإعادة التذكير لدى Google، وهو
يتوافق مع حساب المستخدم داخل اللعبة. تخزِّن Google تلقائيًا
هذا الرمز المميّز من أجل تذكُّر بيانات الألعاب في ملف المستخدم الشخصي على "خدمات ألعاب Play".
يقرّر المستخدم الآن تشغيل اللعبة على "ألعاب Google Play على
الكمبيوتر" للمرة الأولى. يتم تسجيل دخول المستخدم تلقائيًا باستخدام حسابه على "خدمات ألعاب Play"، ويتحقّق برنامج تشغيل اللعبة لمعرفة ما إذا كان هناك أي مستوى تقدّم متاحًا لمستخدم "خدمات ألعاب Play" هذا. بعد ذلك، يطلب خادم اللعبة من
Google معرفة ما إذا كانت هناك أي رموز مميّزة لهذا الحساب على PGS. بما أنّه تم العثور على الحساب، تُرسِل Google الرمز المميّز لإعادة التذكر، ويستخدم خادم اللعبة هذا الرمز المميّز للعثور على حساب المستخدم المرتبط Racer94 واستعادة مستوى تقدّمه.
بما أنّ تسجيل الدخول باستخدام "خدمات ألعاب Play" هو تجربة سلسة، يستعيد التطبيق مستوى تقدّم المستخدم بدون الحاجة إلى إدخال اسم مستخدم أو
كلمة مرور. بالإضافة إلى ذلك، يمكن للمطوّر استخدام ميزة تسجيل الدخول إلى "خدمات ألعاب Play" باستخدام نظام هويته الحالي، والاعتماد على Google لتخزين الرابط بين مستوى تقدّم اللاعب وحسابه على "خدمات ألعاب Play".
كما هو موضّح في المثال السابق، هناك إجراءان رئيسيان تنفّذهما واجهة برمجة التطبيقات Recall API:
تخزين الرمز المميّز لدى Google عندما يسجّل المستخدم الدخول باستخدام أحد حساباته في اللعبة
استرداد الرمز المميّز لمستخدم لاستعادة حساباته في اللعبة
بالإضافة إلى الرموز المميّزة لميزة "الرجوع إلى آخر نقطة"، تتطلّب واجهة برمجة التطبيقات Recall API أيضًا معرّفًا ثابتًا
يتوافق مع الحساب داخل اللعبة، والمعروف باسم الشخصية، لفرض
قيود العدد المطلق للعناصر. يمكنك اعتبار الشخصية
كالتصنيف الذي يمثّل حساب المستخدم داخل اللعبة ضمن نظام هوية المطوّر، ورمز استرداد القيمة كمفتاح يُستخدَم لاستعادة حساب
المستخدم داخل اللعبة. يجب عدم إعادة استخدام قيم الشخصيات والرموز المميّزة
في مختلف
مشاريع PGS.
بالإضافة إلى ذلك، على الرغم من أنّه يمكن تغيير الرموز المميّزة لإعادة التذكير بمرور الوقت، يجب أن تكون الشخصية مستقرة
وفقًا لحساب المستخدم داخل اللعبة.
قواعد عدد القيم الفريدة
تفرض واجهة برمجة التطبيقات Recall API علاقة بنسبة 1:1 بين الملفات الشخصية في "خدمات ألعاب Play" والحسابات داخل اللعبة (يُشار إليها باسم قواعد العدد الإجمالي)، حيث لا يمكن ربط ملف شخصي واحد إلا بملف شخصي واحد في "خدمات ألعاب Play"، ولا يمكن ربط ملف شخصي واحد في "خدمات ألعاب Play" إلا بملف شخصي واحد. يتم استخدام الشخصية كمعرّف ثابت لحساب داخل اللعبة،
لأنّ الرموز المميّزة لإعادة التذكير قد تتغيّر بمرور الوقت.
قد يتم أيضًا تغيير الشخصية المرتبطة بملف شخصي على "خدمات ألعاب Play" بمرور الوقت (نظرًا لربط حساب مختلف
في اللعبة بملف PGS).
العمليات الفنية لتخزين الرموز المميّزة لتذكُّر بيانات الألعاب واستردادها
يتناول هذا القسم العملية الفنية بين برنامج تشغيل اللعبة والخوادم مع
خوادم Google عند تخزين الرموز المميّزة لإعادة التذكير واستردادها.
الخطوة 1: تسجيل الدخول بحساب مستخدم PGS واسترداد معرّف الجلسة
تبدأ اللعبة حزمة تطوير البرامج (SDK) لخدمة "خدمات ألعاب Play" وتحاول تسجيل دخول المستخدم من خلال هذه الخدمة.
بافتراض أنّ المستخدم سجّل الدخول، اطلب معرّف جلسة من حزمة SDK للألعاب على العميل
للعبة، واطلب رمزًا مميزًا لبروتوكول OAuth 2.0 من الخلفية في OAuth من Google. يتم استخدام معرّف الجلسة والرموز المميزة من الإصدار 2.0 من OAuth للتواصل مع الجانب الخلفي من Google Games.
الخطوة 2: استرداد أي رمز مميّز متاح لإعادة التذكير
الخطوة 3(أ): استعادة مستوى التقدّم في حال توفّر الرمز المميّز
إذا كان هناك رمز مميّز، استردّه وفكّ تشفيره واستعدّ بيانات المستخدم.
الخطوة 3(ب): تخزين رمز مميّز في حال عدم توفّره
وبما أنّه لا يتوفّر رمز مميّز، لا تتم استعادة أيّ تقدّم. يواصل المستخدم تسجيل الدخول
باستخدام نظام تحديد الهوية لدى المطوّر، أو ينشئ حسابًا جديدًا إذا لم يكن لديه حساب
حالي. ملاحظة: لا يتم تسجيل الدخول باستخدام "خدمات ألعاب Play" (التي سبق أن تم استخدامها)، ولكن
باستخدام نظام هوية المطوّر خارج "خدمات ألعاب Play".
أنشئ رمزًا مميزًا مشفَّرًا لإعادة التذكير يُشفِّر حساب المستخدم داخل اللعبة، ثم
أرسِله إلى Google مع معرِّف الجلسة ورمز OAuth 2.0. في هذه المرحلة،
تُنشئ Google رابطًا بين رمز الاستدعاء الذي تم إرساله وحساب PGS الخاص
باللاعب.
عمليات المستخدمين الذين ليس لديهم ملف شخصي على "خدمات ألعاب Play"
يمكنك تخزين الرموز المميّزة لتذكُّر بيانات الألعاب لمستخدم لم ينشئ ملفًا شخصيًا على "خدمات ألعاب Play" بعد من خلال
استخدام الوضع "بدون ملف شخصي". ومع ذلك، هناك تحذيران مهمّان:
لا يمكنك استرداد الرموز المميّزة لمستخدم ليس لديه ملف شخصي على "خدمات ألعاب Play". يتم تلقائيًا طلب إنشاء ملف شخصي عندما يحاول المستخدم تسجيل الدخول إلى لعبتك باستخدام "خدمات ألعاب Play" على جهاز ثانٍ.
يجب اتّباع إرشادات إضافية
لضمان توفّر إشعار مناسب يصف العناصر التالية و
الحصول على موافقة المستخدم النهائي المناسبة:
مشاركة البيانات مع Google لتفعيل ميزة ربط حساب "ألعاب Play"
توفُّر إعدادات لإدارة هذه المشاركة، مثل إعدادات "ألعاب Google Play"
يفتح مستخدم ليس لديه ملف شخصي على "خدمات ألعاب Play" لعبة تم تفعيل ميزة تذكُّر الحسابات المُستخدَمة بدون ملف شخصي فيها.
تؤدي حزمة تطوير البرامج (SDK) لألعاب Google إلى بدء عملية تسجيل دخول تلقائية، ولكنّها تنتهي بالفشل لأنّ المستخدم ليس لديهملف شخصي على "خدمات ألعاب Play".
تعرِض حزمة SDK لألعاب Google شريط معلومات يُعلم المستخدم بأنّ اللعبة تمت
دمجها مع Google. يمكن للمستخدم اتخاذ إجراء بشأن شريط المعلومات هذا، إذ يمكنه إيقاف ميزة التذكير إلى أن يتم إنشاء ملف شخصي.
تطلب اللعبة إذن الوصول إلى ميزة "الرجوع". يُرجى العِلم أنّ "خدمات ألعاب Play" ترفض طلبات الوصول إلى ميزة "تذكُّر الحسابات"
عندما تكون هناك ملفات شخصية في "خدمات ألعاب Play" على الجهاز أو عندما لا تكون هناك حسابات Google
على الجهاز. في هذه الحالة، من المفترض أن تستمر اللعبة بدون استخدام
PGS.
بعد أن يسجّل المستخدم الدخول باستخدام حساب داخل اللعبة، تنشئ اللعبة رمزًا مميزًا وزوجًا من
الشخصيات للمستخدم يتوافق مع حسابه داخل اللعبة. تخزِّن اللعبة
هذا الاقتران مع Google. قد تخزِّن اللعبة المزيد من الرموز المميزة لاحقًا إذا سجَّل العميل الدخول إلى حسابات أخرى داخل اللعبة.
تشغيل لعبة على جهاز جديد
يفتح مستخدم ليس لديه ملف شخصي على "خدمات ألعاب Play" لعبة تم تفعيل ميزة تذكُّر بيانات الألعاب بدون ملف شخصي عليها
على جهاز.
تسجِّل اللعبة رمزًا مميزًا لتذكُّر بيانات الألعاب بدون ملف شخصي كما هو موضّح في تخزين رمز مميّز
وزوج شخصية.
يفتح المستخدم اللعبة نفسها على جهاز مختلف تم إعداده بالطريقة نفسها.
تؤدي حزمة تطوير البرامج (SDK) لألعاب Google إلى بدء عملية إنشاء الملف الشخصي. يمكن للمستخدم مراجعة ورفض
الرموز المميّزة التي تم تخزينها سابقًا من أجل تذكُّر بيانات الألعاب. ينشئ المستخدم ملفًا شخصيًا في "خدمات ألعاب Play" في هذه المرحلة.
اكتمال تسجيل الدخول التلقائي إلى PGS، وتتلقّى اللعبة الحالة
تم المصادقة.
تسترجع اللعبة رموز Recall المميّزة للمستخدم كالمعتاد.
الخطوات التالية
لدمج واجهة برمجة التطبيقات Recall API مع العميل وخادم اللعبة، يُرجى اتّباع
هذه الإرشادات.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Recall API\n\nThe Recall API lets games manage links between Google Play Games Services (PGS) users and\ntheir in-game accounts by storing *recall tokens* with Google servers. Here's a\nsample scenario of how the Recall API might be used.\n\n1. A user is playing a game where the developer has an identity system to track\n user progress, and uses PGS in parallel with other authentication methods to\n log users into their game. In this example, a user is logged into their PGS\n account *Laura* , and creates an in-game account with the developer's\n identity system called *Racer94*. As the user plays the game, the\n developer's game server syncs their progress.\n\n2. Separately, the developer saves a recall token with Google, which\n corresponds with the user's in-game account. Google automatically stores\n that recall token against the user's PGS profile.\n\n3. The user now decides to play the game on [GPG on\n PC](/games/playgames/overview) for the first time. The user is automatically\n signed in with their PGS account, and the game client checks to see if there\n is any progress available for this PGS user. The game server then queries\n Google to see if there are any tokens for this PGS account. Since there are,\n Google sends back the recall token, and the game server uses that token to\n find the user's associated account Racer94, and restore their progress.\n Since signing in with PGS is a frictionless experience, the user's progress\n is restored by the app without the user needing to enter a username or\n password. Furthermore, the developer can use PGS sign-in with their existing\n identity system, and rely on Google to store the link between player\n progress and their PGS account.\n\nAs seen in the example earlier, there are two main actions which are performed\nby the Recall API:\n\n- **Storing** the token with Google when a user logs in with one of the in-game\n accounts.\n\n- **Retrieving** the token for a user in order to restore their in-game\n accounts.\n\nIn addition to recall tokens, the Recall API also requires a stable identifier\ncorresponding to the in-game account, known as *persona* , to enforce\n[cardinality constraints](#enforcing-cardinality). You might think of a persona\nas the label which represents the user's in-game account within the developer's\nidentity system, and the recall token as a key which is used to restore the\nuser's in-game account to the game. Persona and token values must not be reused\nacross different\n[PGS projects](/games/pgs/console/setup#add_your_game_to_the).\nAlso, while recall tokens may be changed over time, a persona should be stable\naccording to the user's in-game account.\n| **Note:** Strings used for recall tokens and personas must be opaque and not contain any sensitive or personally-identifiable information (including but not limited to name, email address, and demographics). Games must use robust encryption algorithms for generating recall tokens.\n\nCardinality rules\n-----------------\n\nThe Recall API enforces a 1:1 relationship between PGS profiles and in-game\naccounts (referred to as *cardinality rules*), where one persona can only be\nlinked to one PGS profile, and one PGS profile can only be linked to one\npersona. The persona is used as a stable identifier for an in-game account,\nsince recall tokens may change over time.\n\nThe persona linked to a PGS profile may also be changed over time (as different\nin-game accounts are linked to the PGS profile).\n\nTechnical flows for storing and retrieving the recall tokens\n------------------------------------------------------------\n\nThis section covers the technical flow between the game client and servers with\nGoogle servers when storing and retrieving recall tokens.\n\n### Step 1: Sign in the PGS User and retrieve the session ID\n\nThe game initializes the PGS SDK and attempts to sign the user in with PGS.\n\nAssuming the user is signed in, request a session ID from the Games SDK on the\ngame client, and request an OAuth 2.0 token from Google's OAuth backend. The\nsession ID and OAuth 2.0 tokens are used to communicate with the Google Games\nbackend.\n\n### Step 2: Retrieve any available recall token\n\nRequest for any associated recall token with the PGS user's account. If a token\nis present, [proceed to Step 3a and restore progress](#restore-progress).\nOtherwise, if this is a new user and they have no token present, [proceed to\nStep 3b and store a new token](#store-tokens).\n\n### Step 3a: If token is present, restore progress\n\nIf a token is present, retrieve and decrypt the token, and restore user data.\n\n### Step 3b: If no token is present, store a token\n\nSince no token is present, no progress is restored. The user proceeds to sign in\nwith the developer's identity system, or creates a new account if one does not\nexist. Note - this isn't signing in with PGS (which has been done already), but\nwith a developer's identity system outside of PGS.\n\nCreate an encrypted recall token which encodes the user's in-game account, and\nsend it to Google along with the session ID and OAuth 2.0 token. At this point,\nGoogle creates an association between the recall token which was sent, and the\nplayer's PGS account.\n\nFlows for users without a PGS profile\n-------------------------------------\n\nYou can store recall tokens for a user who hasn't created a PGS profile yet by\nusing profileless mode. However, there are two important caveats:\n\n- You can't retrieve tokens for a user who doesn't have a PGS profile. Profile creation is automatically prompted when the user tries to log into your game with Play Games Services on a second device.\n- You must follow [additional guidelines](/games/pgs/recall/recall-setup#terms) to ensure you have an appropriate notice describing the following items and obtaining the appropriate end-user consent:\n - Your sharing of the data with Google to enable the Play Games account linking feature.\n - The availability of settings to manage this sharing, such as Play Games settings.\n - The processing of such data under the [Google Privacy\n Policy](https://policies.google.com/privacy).\n\n### Store a token and persona pair\n\n1. A user without a PGS profile opens a game that has profileless recall enabled.\n2. The Games SDK triggers an automatic sign-in, which fails because the user has no PGS profile.\n3. The Games SDK shows a snackbar that informs the user that the game has integration with Google. This snackbar is actionable---the user can disable recall until a profile is created.\n4. The game requests recall access. Note that PGS rejects recall access requests when there are PGS profiles on the device or when there are no Google Accounts on the device. In that case, the game should proceed without using PGS.\n5. After the user logs in with an in-game account, the game creates a token and persona pair for the user that corresponds to their in-game account. The game stores this pair with Google. The game might store more tokens later if the user logs into other in-game accounts.\n\n### Launch a game on a new device\n\n1. A user without a PGS profile opens a game that has profileless recall enabled on a device.\n2. The game records a profileless recall token as described in [Store a token\n and persona pair](#profileless-store).\n3. The user opens the same game on a different device that has the same account setup.\n4. The Games SDK triggers profile creation. The user can review and reject previously stored recall tokens. The user creates a PGS profile at this time.\n5. The automatic sign-in into PGS completes, and the game receives the authenticated status.\n6. The game retrieves recall tokens for the user as usual.\n\nNext steps\n----------\n\nIn order to integrate the Recall API with your client and game server, [follow\nthis guidance](/games/pgs/recall/recall-setup)."]]