تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
في السوق الأساسي، يُعد تطبيق الهاتف الطريقة السائدة التي يتفاعل بها المستخدم مع التطبيق.
ضبط خلفية شاشة الساعة
عندما يختار المستخدم خلفية شاشة ساعة في تطبيق الهاتف، يتضمّن المسار التالي لضبط خلفية شاشة الساعة جزأين:
التثبيت: ثبِّت خلفية شاشة الساعة باستخدام ميزة "إرسال خلفية شاشة الساعة" التي يتم بدءها من خلال MessageClient. هذه الخطوة بسيطة، إذ يتم استخدام addWatchFace أو updateWatchFace، ويتم تشغيلها باستخدام MessageClient من الهاتف إلى الساعة.
قد لا يكون عليك اتّخاذ أي إجراء. قد يتحكّم السوق في خلفية شاشة الساعة النشطة.
قد لا يكون من الضروري أن يتدخّل المستخدم. يجب أن يكون لدى التطبيق الأذونات اللازمة لضبط خلفية شاشة الساعة النشطة، وأن يتمكّن من إجراء ذلك مباشرةً باستخدام setWatchFaceAsActive().
قد تكون هناك إرشادات مطلوبة، إما حول كيفية قبول طلبات الأذونات أو كيفية ضبط خلفية شاشة الساعة يدويًا باستخدام إيماءة الضغط مع الاستمرار أو من خلال تطبيق مصاحب.
ردّ التثبيت
لتسهيل مرحلة التفعيل، يجب أن تعرض مرحلة التثبيت المعلومات التالية من الساعة إلى الهاتف:
نتيجة محاولة التثبيت
نتيجة isWatchFaceActive() - لتحديد ما إذا كان التطبيق يتضمّن خلفية شاشة الساعة النشطة.
ما إذا تم استدعاء setWatchFaceAsActive() من قبل - يجب أن يتتبّع تطبيق Wear OS هذه المعلومات ويحتفظ بها على الجهاز. لا يمكن استخدام طلب البيانات من واجهة برمجة التطبيقات هذا إلا مرة واحدة.
التفعيل
بعد التثبيت، قد تشير الاستجابة إلى أنّ التطبيق يتضمّن خلفية شاشة الساعة النشطة. ومع ذلك، إذا لم يكن الأمر كذلك، يمكن للتطبيق اختيار عرض زر لضبط خلفية شاشة الساعة كخلفية نشطة.
السيناريو 1: استنفاد جميع محاولات ضبط خلفية شاشة الساعة النشطة
إذا أشارت الاستجابة من عملية التثبيت إلى أنّه تم استدعاء setWatchFaceAsActive() من قبل، يجب أن يؤدي الزر إلى شاشة تعليمية على الهاتف توضّح للمستخدم كيفية النقر مع الاستمرار على خلفية الساعة لضبطها يدويًا على الخلفية التي يريدها.
السيناريو 2: محاولة ضبط خلفية شاشة الساعة النشطة
يجب أن يطلب الهاتف من الساعة التحقّق من توفّر إذن SET_PUSHED_WATCH_FACE_AS_ACTIVE اللازم:
إذا كان المستخدم قد منح الإذن مسبقًا، انتقِل إلى استدعاء setWatchFaceAsActive().
إذا كان المستخدم قد رفض الإذن سابقًا، يجب أن تنقل الساعة هذه المعلومات إلى الهاتف، حيث يمكن عرض شاشة توضيحية تشرح الحاجة إلى الإذن وكيفية منحه يدويًا.
إذا لم يتم طلب الإذن من قبل، يجب أن تطلب الساعة من الهاتف عرض لحظة تعليمية ترشد المستخدم إلى كيفية قبول الأذونات على الساعة، ويجب أن تطلب الساعة الإذن.
إذا منح المستخدم الإذن، يجب أن تتصل الساعة بعد ذلك بالدالة
setWatchFaceAsActive().
وفي حال عدم توفّر ذلك، يجب أن تطلب الساعة من الهاتف عرض شاشة تعليمية توضّح الحاجة إلى الحصول على الإذن وكيفية منحه يدويًا.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Configure your phone app for Watch Face Push\n\nFor the canonical marketplace, the phone app is the predominant way in which\nthe user interacts with the app.\n\nSet a watch face\n----------------\n\nWhen the user selects a watch face in the phone app, there are two parts to the\nsubsequent flow to set the watch face:\n\n1. **Installation:** Install the watch face using Watch Face Push, initiated through `MessageClient`. This step is straightforward, using either `addWatchFace` or `updateWatchFace`, triggered using `MessageClient` from the phone to the watch.\n2. **Activation:** [Set the installed watch face as active](/training/wearables/watch-face-push/wear-os-app#set-watch-face-as-active). This step has several possible paths, depending on the permission state:\n - There may be **no action needed**. The marketplace may already have control of the active watch face.\n - There may be **no user intervention needed** . The app has the necessary permissions to set the active watch face, and can do so directly using `setWatchFaceAsActive()`.\n - There may be **guidance needed**, either as to how to accept permission requests, or how to manually set the watch face using a long-press gesture or through a companion app.\n\nInstallation response\n---------------------\n\nTo facilitate the **Activation** phase, the **Installation** phase should return\nthe following information from the watch to the phone:\n\n- The outcome of the installation attempt\n- The result of `isWatchFaceActive()` - to determine whether the app already has the active watch face.\n- Whether `setWatchFaceAsActive()` has already been called in the past - the Wear OS app should track and persist this information locally. *This API\n call can only be used once.*\n\nActivation\n----------\n\nFollowing the installation, the response may indicate that the app already has\nthe active watch face. However if it does not, then the app may choose to show a\nbutton to **set watch face as active**.\n\n### Scenario 1: All attempts to set the active watch face are exhausted\n\nIf the response from installation indicated that `setWatchFaceAsActive()` had\nalready been called in the past, then the button should lead to an education\nscreen on the phone, showing the user how to touch \\& hold on the watch face to\nmanually set it to the one they want.\n\n### Scenario 2 - Try to set the active watch face\n\nThe phone should instruct the watch to check for the necessary\n`SET_PUSHED_WATCH_FACE_AS_ACTIVE` permission:\n\n- If the user has **already granted it**, proceed to calling setWatchFaceAsActive().\n- If the user has **previously denied the permission**, the watch should communicate this back to the phone, where an education screen can be shown explaining the need for the permission and how to manually grant it.\n- If the **permission has not been requested before**, the watch should\n instruct the phone to show an educational moment guiding the user on how to\n accept permissions on the watch, and the watch should proceed to request the\n permission.\n\n - If the user grants the permission, the watch should then call `setWatchFaceAsActive()`.\n - Otherwise the watch should instruct the phone to show an education screen explaining the need for the permission and how to manually grant it."]]