اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
رقم تعريف نظام التشغيل Android
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
keywords: AiAssisted,release16,androidconnectivity,bluetooth,category:AndroidConnectivity,docType:Guide
بدءًا من Android 14، يتضمّن إطار عمل Android خدمة Generic Attribute
(GATT) تُسمّى "خدمة معلومات Android" (AIS)، تتيح لأجهزة Bluetooth
قراءة مستوى واجهة برمجة التطبيقات في Android كخاصية GATT للخدمة.
تتيح هذه الخدمة لمصنّعي أجهزة البلوتوث معرفة ما إذا كان جهاز بلوتوث طرفي يقترن بجهاز مركزي يعمل بنظام التشغيل Android، كما تتيح لهم إدارة منطق متخصص استنادًا إلى مستوى واجهة برمجة التطبيقات.
AIS هي خدمة GATT عادية ولا يمكن أن يكون هناك سوى مثيل واحد من AIS على الجهاز. معرّف UUID للخدمة الأساسية هو e73e0001-ef1b-4e74-8291-2e4f3164f3b5
.
تحتوي سمة مستوى واجهة برمجة التطبيقات في Android (المعرّف الفريد العالمي (UUID):
e73e0002-ef1b-4e74-8291-2e4f3164f3b5
) على مستوى واجهة برمجة التطبيقات للجهاز كعدد صحيح غير موقّع بنظام 32 بت في شكل ثنائي (little-endian). تبلغ قيمة سمة مستوى واجهة برمجة التطبيقات لنظام Android 4 ثمانيات (على سبيل المثال، مستوى واجهة برمجة التطبيقات 36 هو 0x24_00_00_00
). وعندما يكون الجهاز قابلاً للاكتشاف، يمكن قراءة قيمة سمة مستوى واجهة برمجة التطبيقات لنظام Android بدون مصادقة أو تفويض.
عندما لا يكون الجهاز قابلاً للاكتشاف، لا يمكن قراءة سمة مستوى واجهة برمجة التطبيقات في Android إلا بعد المصادقة والتفويض.
استكشاف الخدمة
يكون جهاز البلوتوث في دور عميل GATT، ويكون جهاز Android في دور الخادم. للعثور على AIS وقراءة مستوى واجهة برمجة التطبيقات على Android، تستخدم أجهزة Bluetooth إجراءات ملف تعريف GATT، مثل إجراءات العثور على الخدمة الأساسية والعثور على السمة وقراءة قيمة السمة. للحصول على تفاصيل حول هذه الإجراءات، يمكنك الاطّلاع على مواصفات ملف GATT.
يتم تحديد مستوى واجهة برمجة التطبيقات من خلال سمة النظام ro.build.version.sdk
. إذا تعذّر العثور على الخدمة الأساسية، يعني ذلك أنّه لم يتم تحديد سمة النظام أو أنّ القيمة مضبوطة على فارغة، أو أنّ نظام التشغيل المضيف ليس Android.
التحقُّق
للتحقّق من إمكانية اكتشاف خدمة AIS، يمكنك إجراء اختبار يدوي عن طريق إقران جهاز طرفي يعمل بالبلوتوث بجهاز يعمل بنظام التشغيل Android، ثم البحث عن المعرّف الفريد العالمي (UUID) لخدمة AIS في الخدمات الأساسية التي تم اكتشافها.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-08-22 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-08-22 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Android OS identification\n\nkeywords: AiAssisted,release16,androidconnectivity,bluetooth,category:AndroidConnectivity,docType:Guide\n\nStarting in Android 14, the Android framework includes a Generic Attribute\n(GATT) service called Android information service (AIS), which lets Bluetooth\ndevices read the Android API level as a GATT characteristic of the service.\nThis service lets Bluetooth device manufacturers know whether a Bluetooth\nperipheral is pairing with a central device that is running the Android OS,\nand manage specialized logic based on the API level.\n\nAndroid information service (AIS)\n---------------------------------\n\nAIS is a standard GATT service and there can be only one instance of AIS on\na device. The primary service UUID is `e73e0001-ef1b-4e74-8291-2e4f3164f3b5`.\nThe Android API level characteristic (UUID:\n`e73e0002-ef1b-4e74-8291-2e4f3164f3b5`) contains the API level of the device as\nan unsigned 32-bit integer in binary form (little-endian). The value of the\nAndroid API level characteristic is 4 octets in length (for example, API\nlevel 36 is `0x24_00_00_00`). When the device is discoverable, the Android API\nlevel characteristic value is readable without authentication or authorization.\nWhen the device isn't discoverable, the Android API level characteristic is\nreadable only with authentication and authorization.\n\nDiscover the service\n--------------------\n\nThe Bluetooth device is on the GATT client role and the Android-powered device\nis on the server role. To discover AIS and read the Android API level, Bluetooth\ndevices use GATT profile procedures such as the *primary service discovery* ,\n*characteristic discovery* , and *characteristic value read* procedures. For\ndetails on these procedures, see the [GATT profile specification](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host/generic-attribute-profile--gatt-.html).\n\nThe API level is defined by the `ro.build.version.sdk` system property. If the\nprimary service can't be discovered, it means that the system property isn't\ndefined or the value is set to empty, or the host operation system isn't\nAndroid.\n\nValidation\n----------\n\nTo verify that AIS can be discovered, run a manual test by pairing a Bluetooth\nperipheral with an Android-powered device, and then looking up the AIS service\nUUID in the discovered primary services."]]