تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
لاستخدام واجهة برمجة التطبيقات Google Awareness API، عليك إضافة مفتاح واجهة برمجة تطبيقات Google إلى تطبيقك. يجب أن يكون نوع مفتاح واجهة برمجة التطبيقات الذي تحتاجه هو مفتاح واجهة برمجة تطبيقات Android.
يتم توقيع جميع تطبيقات Android باستخدام شهادة رقمية تمتلك
مفتاحها الخاص. لمزيد من المعلومات عن الشهادات الرقمية، يُرجى الرجوع إلى
دليل Android حول كيفية
توقيع تطبيقك.
تكون مفاتيح واجهة برمجة التطبيقات لنظام التشغيل Android مرتبطة بمجموعات محدّدة من الحِزم والشهادات. تحتاج فقط
إلى مفتاح واحد لكل شهادة، بغض النظر عن عدد مستخدمي
التطبيق.
يجب اتّباع عدة خطوات للحصول على مفتاح لتطبيقك. وقد تم وصفها بالتفصيل في هذا الدليل، ويمكن تلخيصها على النحو التالي:
الحصول على معلومات عن شهادة تطبيقك
سجِّل مشروعًا في Google Developers Console وأضِف واجهة برمجة التطبيقات User Context
API كخدمة للمشروع.
اطلب مفتاحًا.
أضِف المفتاح إلى تطبيقك. ولإجراء ذلك، أضِف عنصرًا إلى بيان تطبيقك.
العثور على معلومات شهادة تطبيقك
يستند مفتاح واجهة برمجة التطبيقات إلى نموذج مختصر لشهادة تطبيقك الرقمية، ويُعرف باسم مرجع SHA-1. لعرض الملف المرجعي لشهادة SHA-1
، تأكَّد أولاً من استخدام الشهادة
الصحيحة. قد تتوفّر لك الشهادتان التاليتان للاختيار من بينهما:
شهادة تصحيح الأخطاء: تنشئ أدوات حزمة تطوير البرامج (SDK) لنظام التشغيل Android
هذه الشهادة تلقائيًا عند إنشاء إصدار لتصحيح الأخطاء. لا تستخدِم
هذه الشهادة إلا مع التطبيقات التي تختبرها.
لا تحاول نشر تطبيق موقَّع باستخدام شهادة تصحيح أخطاء.
يمكنك الاطّلاع على مزيد من التفاصيل حول شهادة تصحيح الأخطاء في القسم
توقيع
إصدار تصحيح الأخطاء ضمن مستندات مطوّري تطبيقات Android.
شهادة الإصدار: تنشئ أدوات حزمة SDK لنظام التشغيل Android
هذه الشهادة عند إنشاء إصدار علني. يمكنك أيضًا إنشاء هذه الشهادة باستخدام برنامج keytool. استخدِم هذه الشهادة عندما
تكون مستعدًا لطرح تطبيقك على مستوى العالم.
لمزيد من المعلومات عن keytool، يُرجى الاطّلاع على
مستندات Oracle.
شهادة تصحيح الأخطاء
عرض الملف المرجعي لشهادة تصحيح الأخطاء
استخدِم برنامج keytool مع المَعلمة -v لعرض
الملف المرجعي لشهادة SHA-1. لإجراء ذلك، يُرجى إكمال الخطوات التالية:
حدِّد موقع ملف تخزين مفاتيح تصحيح الأخطاء. اسم الملف هو
debug.keystore، ويتم إنشاؤه في المرة الأولى التي تُنشئ فيها
مشروعك. يتم تخزينه تلقائيًا في الدليل نفسه الذي تتوفّر فيه ملفات جهاز Android
Virtual Device (AVD):
OS X وLinux: ~/.android/
Windows Vista وWindows 7: C:\Users\your_user_name\.android\
إدراج بصمة SHA-1:
بالنسبة إلى نظام التشغيل Linux أو OS X، افتح نافذة محطة طرفية وأدخِل ما يلي:
استخدِم برنامج keytool مع المَعلمة -v لعرض
الملف المرجعي لشهادة SHA-1. لإجراء ذلك، يُرجى إكمال الخطوات التالية:
حدِّد مكان ملف تخزين مفاتيح شهادة الإصدار. لا يتوفّر موقع أو اسم تلقائيان
لمستودع مفاتيح الإصدار. إذا لم تحدِّد توقيعًا عند
إنشاء تطبيقك للإصدار، سيبقى
.apk بدون توقيع وسيكون عليك توقيعه قبل التمكّن من
نشره. بالنسبة إلى شهادة الإصدار، ستحتاج أيضًا إلى
الاسم المعرِّف للشهادة وكلمات مرور ملف تخزين المفاتيح والشهادة.
أدخِل ما يلي لعرض الأسماء البديلة لجميع المفاتيح في مخزن مفاتيح:
keytool-list-keystoreyour_keystore_name
استبدِل your_keystore_name بالمسار المُحدَّد بالكامل
واسم ملف تخزين المفاتيح. أدرِج الإضافة .keystore. أدخِل كلمة مرور ملف تخزين المفاتيح عندما يُطلب منك ذلك. بعد ذلك، يعرض
keytool جميع الأسماء البديلة في مخزن المفاتيح.
يحتوي السطر الذي يبدأ بالرمز SHA1 على الملف المرجعي لشهادة SHA-1. البصمة هي تسلسل 20 رقمًا سداسيًا عشريًا
يتكوّن من رقمَين مفصولَين بنقطتَين.
الحصول على مفتاح واجهة برمجة التطبيقات من Google Developers Console
لبدء استخدام Google Awareness API، انقر على الزر الحصول على مفتاح. ويرتبط
بـ Google Developers Console التي ترشدك خلال العملية وتفعِّل بدورها واجهة برمجة التطبيقات Awareness API تلقائيًا.
انقر على متابعة لتفعيل واجهة برمجة التطبيقات Awareness API.
في صفحة "بيانات الاعتماد"، أنشئ مفتاح Android واضبط بيانات اعتماد واجهة برمجة التطبيقات.
في مربّع الحوار "إنشاء مفتاح"، عليك حصر الاستخدام على تطبيقات Android.
لإجراء ذلك، أدخِل بصمة SHA-1 لتطبيقك واسم الحزمة، كما هو موضّح في المثال التالي:
انقر على إنشاء. سيظهر مفتاح واجهة برمجة التطبيقات الجديد لنظام التشغيل Android في قائمة مفاتيح
واجهة برمجة التطبيقات لمشروعك. مفتاح واجهة برمجة التطبيقات هو سلسلة من الأحرف، مثل ما يلي:
AIzaSyBdVl-cTICSwYKrZ95LoVuw7dbMuDt1KG0
بعد أن حصلت على مفتاح واجهة برمجة التطبيقات، يمكنك إضافته إلى بيان تطبيقك كما هو описан في دليل البدء.
تفعيل واجهات برمجة التطبيقات الإضافية
تتيح لك واجهة برمجة التطبيقات Awareness API الوصول إلى أنواع متعدّدة من البيانات السياقية، مثل
الإشارة. لاستخدام هذه الأنواع، عليك تفعيل واجهتَي برمجة التطبيقات المعنيّتَين في Google Developers Console.
تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-31 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eTo use the Google Awareness API, you need an Android API key linked to your app's certificate.\u003c/p\u003e\n"],["\u003cp\u003eYou can obtain your app's certificate SHA-1 fingerprint using the \u003ccode\u003ekeytool\u003c/code\u003e program, ensuring to use the correct debug or release certificate.\u003c/p\u003e\n"],["\u003cp\u003eGet an API key from the Google Developers Console by providing your app's SHA-1 fingerprint and package name.\u003c/p\u003e\n"],["\u003cp\u003eAdd the generated API key to your app's manifest to start using the Google Awareness API.\u003c/p\u003e\n"],["\u003cp\u003eFor using additional contextual data types like beacons, you need to enable the corresponding APIs in the Google Developers Console.\u003c/p\u003e\n"]]],["To use the Google Awareness API, obtain an Android API key linked to your app's certificate-package pair. This requires getting your app's SHA-1 fingerprint from either a debug or release certificate using the `keytool` program. Then, register a project in the Google Developers Console, enable the Awareness API, and request a key by entering the SHA-1 fingerprint and package name. Finally, add this key to your app's manifest and, if needed, activate other related APIs like the Nearby Messages API.\n"],null,["# Signup and API keys\n\nTo use the Google Awareness API, you must add a Google API key to your app. The\ntype of API key you need is an Android API key.\n\nAll Android apps are signed with a digital certificate for which you hold the\nprivate key. For more information about digital certificates, refer to the\nAndroid guide on how to\n[sign your app](https://developer.android.com/tools/publishing/app-signing).\n\nAndroid API keys are linked to specific certificate-package pairs. You only\nneed one key for each certificate, no matter how many users you have for the\napp.\n\nSeveral steps are required for you to get a key for your app. They're described\nin detail in this guide, and are summarized as follows:\n\n1. Get information about your app's certificate.\n2. Register a project in the Google Developers console and add the User Context API as a service for the project.\n3. Request a key.\n4. Add the key to your app. To do so, add an element to your app manifest.\n\nFind your app's certificate information\n---------------------------------------\n\nThe API key is based on a short form of your app's digital certificate,\nknown as its *SHA-1 fingerprint*. To display the SHA-1\nfingerprint for your certificate, first ensure that you use the right\ncertificate. You might have the following two certificates to choose from:\n\n- **A debug certificate** : The Android SDK tools generate this certificate automatically when you do a debug build. Only use this certificate with apps that you're testing. Don't attempt to publish an app that's signed with a debug certificate. The debug certificate is described in more detail in the [Sign your\n debug build](https://developer.android.com/tools/publishing/app-signing.html#debug-mode) section in the Android developer documentation.\n- **A release certificate** : The Android SDK tools generate this certificate when you do a release build. You can also generate this certificate with the `keytool` program. Use this certificate when you're ready to release your app to the world.\n\nFor more information about `keytool`, see its\n[Oracle documentation](http://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html).\nDebug certificate \n\n### Display the debug certificate fingerprint\n\nUse the `keytool` program with the `-v` parameter to display a\ncertificate's SHA-1 fingerprint. To do so, complete the following steps:\n\n1. Locate your debug keystore file. The file name is\n `debug.keystore`, and it's created the first time you build your\n project. By default, it's stored in the same directory as your Android\n Virtual Device (AVD) files:\n\n - **OS X and Linux** : `~/.android/`\n - **Windows Vista and Windows 7** : `C:\\Users\\your_user_name\\.android\\`\n2. List the SHA-1 fingerprint:\n\n - For Linux or OS X, open a terminal window and enter the following:\n\n ```gdscript\n keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android\n ```\n - For Windows Vista and Windows 7, run the following:\n\n ```gdscript\n keytool -list -v -keystore \"%USERPROFILE%\\.android\\debug.keystore\" -alias androiddebugkey -storepass android -keypass android\n ```\n\nYou should see output similar to the following: \n\n```carbon\nAlias name: androiddebugkey\nCreation date: Jan 01, 2013\nEntry type: PrivateKeyEntry\nCertificate chain length: 1\nCertificate[1]:\nOwner: CN=Android Debug, O=Android, C=US\nIssuer: CN=Android Debug, O=Android, C=US\nSerial number: 4aa9b300\nValid from: Mon Jan 01 08:04:04 UTC 2013 until: Mon Jan 01 18:04:04 PST 2033\nCertificate fingerprints:\n MD5: AE:9F:95:D0:A6:86:89:BC:A8:70:BA:34:FF:6A:AC:F9\n SHA1: BB:0D:AC:74:D3:21:E1:43:07:71:9B:62:90:AF:A1:66:6E:44:5D:75\n Signature algorithm name: SHA1withRSA\n Version: 3\n```\nRelease certificate \n\n### Display the release certificate fingerprint\n\nUse the `keytool` program with the `-v` parameter to display a\ncertificate's SHA-1 fingerprint. To do so, complete the following steps:\n\n1. Locate your release certificate keystore file. There's no default location or name for the release keystore. If you don't specify one when you build your app for release, the build leaves your `.apk` unsigned and you have to sign it before you can publish it. For the release certificate, you also need the certificate's alias, the passwords for the keystore, and the certificate.\n2. Enter the following to list the aliases for all the keys in a keystore:\n\n ```gdscript\n keytool -list -keystore your_keystore_name\n \n ```\n3. Replace `your_keystore_name` with the fully qualified path and name of the keystore. Include the `.keystore` extension. Enter the keystore's password when prompted. Then, `keytool` displays all the aliases in the keystore.\n4. Enter the following at a terminal or command prompt:\n\n ```gdscript\n keytool -list -v -keystore your_keystore_name -alias your_alias_name\n \n ```\n5. Replace *`your_keystore_name`* with the fully qualified path and name of the keystore. Include the `.keystore` extension.\n6. Replace `your_alias_name` with the alias that you assigned to the certificate when you created it.\n\nYou should see output similar to the following: \n\n```carbon\nAlias name: \u003calias_name\u003e\nCreation date: Feb 02, 2013\nEntry type: PrivateKeyEntry\nCertificate chain length: 1\nCertificate[1]:\nOwner: CN=Android Debug, O=Android, C=US\nIssuer: CN=Android Debug, O=Android, C=US\nSerial number: 4cc9b300\nValid from: Mon Feb 02 08:01:04 UTC 2013 until: Mon Feb 02 18:05:04 PST 2033\nCertificate fingerprints:\n MD5: AE:9F:95:D0:A6:86:89:BC:A8:70:BA:34:FF:6B:AC:F9\n SHA1: BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:90:AF:A1:66:6E:44:5D:75\n Signature algorithm name: SHA1withRSA\n Version: 3\n```\n\nThe line that begins with `SHA1` contains the certificate's SHA-1\nfingerprint. The fingerprint is the sequence of 20 two-digit hexadecimal\nnumbers separated by colons.\n| **Caution:** To protect your keystore and key, don't enter the `storepass` or `keypass` arguments on the command line unless you're confident of your computer's security. For example, on a public computer, someone could look at your terminal window history or list of running processes, get the password, and then have write access to your signing certificate. This would allow that person to modify or replace your app with their own.\n\nGet an API key from the Google Developers Console\n-------------------------------------------------\n\nTo get started with the Google Awareness API, click the **Get a key** button. It\nlinks to the Google Developers Console, which guides you through the process and\nactivates the Awareness API automatically.\n\nGet a key\n\nAlternatively, follow these steps to get an API key:\n\n1. Go to the [Google Developers Console](https://console.cloud.google.com/flows/enableapi?apiid=usercontext&keyType=CLIENT_SIDE_ANDROID&reusekey=true).\n2. Select a project, or create a new one.\n3. Click **Continue** to enable the Awareness API.\n4. On the \"Credentials\" page, create an Android key and set the API credentials.\n\n | **Note:** If you have an existing Android key, you can use it.\n\n \u003cbr /\u003e\n\n5. In the 'Create key\" dialog, you need to restrict your usage to Android apps.\n To do so, enter your app's SHA-1 fingerprint and package name, like in the\n following example:\n\n BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75\n\n com.example.android.awareness-example\n\n6. Click **Create**. Your new Android API key appears in the list of API\n keys for your project. An API key is a string of characters, like the following:\n\n AIzaSyBdVl-cTICSwYKrZ95LoVuw7dbMuDt1KG0\n\nNow that you have an API key, you can add it to your app's manifest, as\ndescribed in the [Get started](/awareness/android-api/get-started) guide.\n\nActivate Additional APIs\n------------------------\n\nThe Awareness API allows you to access multiple types of contextual data, such\nas [beacons](/beacons). To use these types, you need to enable the corresponding\nAPIs in the Google Developers Console.\n\n| Service | Awareness API methods | API to enable |\n|---------|--------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| Beacons | `SnapshotApi.getBeaconState()`, `FenceApi.BeaconFence` | [Nearby Messages API](https://console.cloud.google.com/flows/enableapi?apiid=copresence&keyType=CLIENT_SIDE_ANDROID&reusekey=true) |"]]