Configurar o app do smartphone para push de mostrador do relógio
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Para o marketplace canônico, o app para smartphone é a principal forma de interação do usuário com o app.
Definir um mostrador de relógio
Quando o usuário seleciona um mostrador do relógio no app para smartphone, há duas partes no
fluxo subsequente para definir o mostrador:
Instalação:instale o mostrador de relógio usando o Watch Face Push, iniciado
pelo MessageClient. Esta etapa é simples, usando addWatchFace ou updateWatchFace, acionados com MessageClient do smartphone para o relógio.
Talvez não seja necessário fazer nada. O marketplace já pode ter
controle do mostrador do relógio ativo.
Talvez não seja necessário fazer nada. O app tem as permissões
necessárias para definir o mostrador de relógio ativo e pode fazer isso diretamente usando
setWatchFaceAsActive().
Pode haver orientações necessárias, seja sobre como aceitar solicitações de permissão ou como definir manualmente o mostrador do relógio usando um gesto de pressionar e manter pressionado ou um app complementar.
Resposta da instalação
Para facilitar a fase de ativação, a fase de instalação precisa retornar as seguintes informações do relógio para o smartphone:
O resultado da tentativa de instalação
O resultado de isWatchFaceActive() para determinar se o app já tem o mostrador de relógio ativo.
Se setWatchFaceAsActive() já foi chamado no passado. O
app Wear OS precisa rastrear e manter essas informações localmente. Essa chamada de API só pode ser usada uma vez.
Ativação
Após a instalação, a resposta pode indicar que o app já tem
o mostrador ativo. No entanto, se não for, o app poderá mostrar um
botão para definir o mostrador do relógio como ativo.
Cenário 1: todas as tentativas de definir o mostrador do relógio ativo foram esgotadas
Se a resposta da instalação indicar que setWatchFaceAsActive() já foi chamado no passado, o botão vai levar a uma tela de instruções no smartphone, mostrando ao usuário como tocar e pressionar o mostrador do relógio para definir manualmente o que ele quer.
Cenário 2: tentar definir o mostrador do relógio ativo
O smartphone precisa instruir o relógio a verificar a permissão
SET_PUSHED_WATCH_FACE_AS_ACTIVE necessária:
Se o usuário já tiver concedido, chame
setWatchFaceAsActive().
Se o usuário já tiver negado a permissão, o relógio vai
comunicar isso ao smartphone, onde uma tela explicativa pode ser mostrada
explicando a necessidade da permissão e como concedê-la manualmente.
Se a permissão não tiver sido solicitada antes, o relógio vai
instruir o smartphone a mostrar um tutorial ensinando o usuário a
aceitar permissões no relógio, e o relógio vai solicitar a
permissão.
Se o usuário conceder a permissão, o relógio vai chamar
setWatchFaceAsActive().
Caso contrário, o relógio vai instruir o smartphone a mostrar uma tela de
educação explicando a necessidade da permissão e como concedê-la
manualmente.
O conteúdo e os exemplos de código nesta página estão sujeitos às licenças descritas na Licença de conteúdo. Java e OpenJDK são marcas registradas da Oracle e/ou suas afiliadas.
Última atualização 2025-08-29 UTC.
[null,null,["Última atualização 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."]]