Configurer l'application de votre téléphone pour le transfert de cadran
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Pour la place de marché canonique, l'application mobile est le principal moyen d'interaction de l'utilisateur avec l'application.
Définir un cadran
Lorsque l'utilisateur sélectionne un cadran dans l'application pour téléphone, le flux suivant pour définir le cadran se compose de deux parties :
Installation : installez la clock face à l'aide de Watch Face Push, lancé via MessageClient. Cette étape est simple. Elle utilise addWatchFace ou updateWatchFace, déclenché à l'aide de MessageClient du téléphone vers la montre.
Aucune action n'est peut-être requise. Il est possible que la place de marché ait déjà le contrôle du cadran actif.
Aucune intervention de l'utilisateur n'est requise. L'application dispose des autorisations nécessaires pour définir le cadran actif et peut le faire directement à l'aide de setWatchFaceAsActive().
Il peut être nécessaire de fournir des instructions, soit pour accepter les demandes d'autorisation, soit pour définir manuellement le cadran à l'aide d'un appui prolongé ou via une application associée.
Réponse d'installation
Pour faciliter la phase d'activation, la phase d'installation doit renvoyer les informations suivantes de la montre au téléphone :
Résultat de la tentative d'installation
Résultat de isWatchFaceActive() pour déterminer si l'application possède déjà le cadran actif.
Indique si setWatchFaceAsActive() a déjà été appelé par le passé. L'application Wear OS doit suivre et conserver ces informations localement. Cet appel d'API ne peut être utilisé qu'une seule fois.
Activation
Après l'installation, la réponse peut indiquer que l'application possède déjà le cadran actif. Toutefois, si ce n'est pas le cas, l'application peut choisir d'afficher un bouton Définir le cadran comme actif.
Scénario 1 : Toutes les tentatives de définition du cadran actif ont échoué
Si la réponse de l'installation indique que setWatchFaceAsActive() a déjà été appelé par le passé, le bouton doit rediriger l'utilisateur vers un écran d'information sur le téléphone, lui montrant comment appuyer de manière prolongée sur le cadran de la montre pour le définir manuellement sur celui de son choix.
Scénario 2 : essayer de définir le cadran actif
Le téléphone doit demander à la montre de vérifier l'autorisation SET_PUSHED_WATCH_FACE_AS_ACTIVE nécessaire :
Si l'utilisateur l'a déjà accordée, passez à l'appel de setWatchFaceAsActive().
Si l'utilisateur a déjà refusé l'autorisation, la montre doit le communiquer au téléphone, où un écran pédagogique peut être affiché pour expliquer la nécessité de l'autorisation et comment l'accorder manuellement.
Si l'autorisation n'a pas été demandée auparavant, la montre doit demander au téléphone d'afficher un message expliquant à l'utilisateur comment accepter les autorisations sur la montre, puis la montre doit procéder à la demande d'autorisation.
Si l'utilisateur accorde l'autorisation, la montre doit ensuite appeler setWatchFaceAsActive().
Sinon, la montre doit demander au téléphone d'afficher un écran pédagogique expliquant la nécessité de l'autorisation et comment l'accorder manuellement.
Le contenu et les exemples de code de cette page sont soumis aux licences décrites dans la Licence de contenu. Java et OpenJDK sont des marques ou des marques déposées d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/29 (UTC).
[null,null,["Dernière mise à jour le 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."]]