קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
במקרה של אפליקציית שוק קנונית, אפליקציית הטלפון היא הדרך העיקרית שבה המשתמש מקיים אינטראקציה עם האפליקציה.
הגדרת תצוגת שעון
כשהמשתמש בוחר תצוגת שעון באפליקציית הטלפון, יש שני חלקים לתהליך הבא להגדרת תצוגת השעון:
התקנה: מתקינים את תצוגת השעון באמצעות Watch Face Push, שמופעל דרך MessageClient. השלב הזה פשוט, ומתבצע באמצעות addWatchFace או updateWatchFace, שמופעלים באמצעות MessageClient מהטלפון לשעון.
יכול להיות שלא נדרשת פעולה. יכול להיות שלחנות האפליקציות כבר יש שליטה בתצוגת השעון הפעילה.
יכול להיות שלא נדרשת התערבות של המשתמש. לאפליקציה יש את ההרשאות הדרושות להגדרת תצוגת השעון הפעילה, והיא יכולה לעשות זאת ישירות באמצעות setWatchFaceAsActive().
יכול להיות שיהיה צורך בהנחיות, למשל איך לאשר בקשות הרשאה, או איך להגדיר את תצוגת השעון באופן ידני באמצעות לחיצה ארוכה או דרך אפליקציה נלווית.
תשובה להתקנה
כדי להקל על שלב ההפעלה, בשלב ההתקנה צריך להחזיר את המידע הבא מהשעון לטלפון:
התוצאה של ניסיון ההתקנה
התוצאה של isWatchFaceActive() – כדי לקבוע אם האפליקציה כבר כוללת את תצוגת השעון הפעילה.
האם בוצעה כבר קריאה ל-setWatchFaceAsActive() בעבר – אפליקציית Wear OS צריכה לעקוב אחרי המידע הזה ולשמור אותו באופן מקומי. אפשר להשתמש בקריאה הזו ל-API רק פעם אחת.
הפעלה
אחרי ההתקנה, יכול להיות שהתגובה תציין שלאפליקציה כבר יש תצוגת שעון פעילה. אבל אם לא, יכול להיות שבאפליקציה תוצג לחצן להגדרת תצוגת השעון כפעילה.
תרחיש 1: מוצו כל הניסיונות להגדיר את תצוגת השעון הפעילה
אם התגובה מההתקנה מציינת שהפונקציה setWatchFaceAsActive() כבר הופעלה בעבר, הלחצן צריך להוביל למסך הדרכה בטלפון, שבו מוצג למשתמש איך ללחוץ לחיצה ארוכה על פני השעון כדי להגדיר אותו באופן ידני למה שהוא רוצה.
תרחיש 2 – ניסיון להגדיר את תצוגת השעון הפעילה
הטלפון צריך להנחות את השעון לבדוק את ההרשאה הדרושה SET_PUSHED_WATCH_FACE_AS_ACTIVE:
אם המשתמש כבר העניק את ההרשאה, ממשיכים לקריאה ל-setWatchFaceAsActive().
אם המשתמש סירב בעבר לתת את ההרשאה, השעון צריך להעביר את המידע הזה לטלפון, שבו יוצג מסך הסבר על הצורך בהרשאה ועל האופן שבו אפשר לתת אותה באופן ידני.
אם לא נשלחה בקשה להרשאה בעבר, השעון צריך להנחות את הטלפון להציג רגע לימודי שמסביר למשתמש איך לאשר הרשאות בשעון, ואז השעון צריך לשלוח בקשה להרשאה.
אם המשתמש מעניק את ההרשאה, השעון צריך להתקשר אל setWatchFaceAsActive().
אחרת, השעון צריך להנחות את הטלפון להציג מסך הסבר על הצורך בהרשאה ואיך מעניקים אותה באופן ידני.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-29 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-29 (שעון UTC)."],[],[],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."]]