Mengonfigurasi aplikasi ponsel untuk Watch Face Push
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Untuk marketplace kanonis, aplikasi ponsel adalah cara utama pengguna berinteraksi dengan aplikasi.
Menyetel tampilan jam
Saat pengguna memilih tampilan jam di aplikasi ponsel, ada dua bagian dalam
alur berikutnya untuk menyetel tampilan jam:
Penginstalan: Instal tampilan jam menggunakan Watch Face Push, yang dimulai
melalui MessageClient. Langkah ini mudah, menggunakan addWatchFace atau updateWatchFace, dipicu menggunakan MessageClient dari ponsel ke smartwatch.
Tidak ada tindakan yang perlu dilakukan. Marketplace mungkin sudah memiliki
kontrol atas tampilan jam aktif.
Tidak diperlukan intervensi pengguna. Aplikasi memiliki izin yang diperlukan untuk menyetel tampilan jam aktif, dan dapat melakukannya secara langsung menggunakan setWatchFaceAsActive().
Mungkin ada panduan yang diperlukan, baik tentang cara menyetujui permintaan izin, atau cara menyetel tampilan jam secara manual menggunakan gestur tekan lama atau melalui aplikasi pendamping.
Respons penginstalan
Untuk memfasilitasi fase Aktivasi, fase Penginstalan harus menampilkan
informasi berikut dari smartwatch ke ponsel:
Hasil upaya penginstalan
Hasil isWatchFaceActive() - untuk menentukan apakah aplikasi sudah memiliki tampilan jam aktif.
Apakah setWatchFaceAsActive() sudah pernah dipanggil sebelumnya - aplikasi Wear OS harus melacak dan menyimpan informasi ini secara lokal. Panggilan API
ini hanya dapat digunakan satu kali.
Aktivasi
Setelah penginstalan, respons dapat menunjukkan bahwa aplikasi sudah memiliki tampilan jam aktif. Namun, jika tidak, aplikasi dapat memilih untuk menampilkan
tombol untuk menyetel tampilan jam sebagai aktif.
Skenario 1: Semua upaya untuk menyetel tampilan jam aktif telah habis
Jika respons dari penginstalan menunjukkan bahwa setWatchFaceAsActive() telah dipanggil sebelumnya, tombol harus mengarah ke layar edukasi di ponsel, yang menunjukkan kepada pengguna cara menyentuh & menahan tampilan jam untuk menyetelnya secara manual ke tampilan jam yang diinginkan.
Skenario 2 - Mencoba menyetel tampilan jam aktif
Ponsel harus menginstruksikan smartwatch untuk memeriksa izin SET_PUSHED_WATCH_FACE_AS_ACTIVE yang diperlukan:
Jika pengguna telah memberikannya, lanjutkan dengan memanggil
setWatchFaceAsActive().
Jika pengguna sebelumnya menolak izin, smartwatch harus
mengirimkan informasi ini kembali ke ponsel, tempat layar edukasi dapat ditampilkan
untuk menjelaskan kebutuhan akan izin dan cara memberikannya secara manual.
Jika izin belum pernah diminta sebelumnya, smartwatch harus
menginstruksikan ponsel untuk menampilkan momen edukasi yang memandu pengguna tentang cara
menyetujui izin di smartwatch, dan smartwatch harus melanjutkan untuk meminta
izin.
Jika pengguna memberikan izin, smartwatch harus memanggil
setWatchFaceAsActive().
Jika tidak, smartwatch akan menginstruksikan ponsel untuk menampilkan layar edukasi yang menjelaskan kebutuhan izin dan cara memberikannya secara manual.
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-08-29 UTC.
[null,null,["Terakhir diperbarui pada 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."]]