본문으로 건너뛰기
Skillpedia
모바일 앱10k · #11940

wear-widgets

하는 일

이 스킬은 Glance Wear와 Remote Compose를 쓰는 Wear OS 위젯을 만들고, 옮기고, 점검하는 방법을 안내합니다. 위젯 클래스, 레이아웃 요소, 상태를 다룹니다. 스마트워치용 위젯을 만드는 Android 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Glance Wear와 Remote Compose로 Wear OS 위젯을 만들고 싶을 때.
  • ✓Wear OS 타일을 위젯으로 옮겨야 할 때.
  • ✓워치 위젯에 버튼 동작이나 바뀌는 로컬 상태가 필요할 때.

스킬 링크

https://github.com/android/skills/blob/main/wear/wear-widgets/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/android/skills/blob/main/wear/wear-widgets/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“다음 캘린더 일정을 보여 주고 완료 표시 버튼이 있는 Wear OS 위젯을 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 최신 라이브러리 버전을 확인하고, SDK와 Compose 요구 사항을 설정한 뒤 위젯 서비스와 UI를 만듭니다. 위젯에 클릭 동작과 로컬 상태도 추가합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Wear OS widgets use androidx.glance.wear (GlanceWearWidget and GlanceWearWidgetService) with androidx.compose.remote (Remote Compose). They serialize declarative UI and state documents to the watch host process.

Prerequisites and setup

  1. Resolve library versions : Resolve the latest versions for {GLANCE_WEAR_VERSION} (androidx.glance.wear), {COMPOSE_REMOTE_VERSION} (androidx.compose.remote), and {WEAR_COMPOSE_REMOTE_VERSION} (androidx.wear.compose.remote). Include -alpha, -beta, or -rc releases when no stable version exists yet. Don't run ./gradlew dependencies to resolve versions:

  2. SDK and Compose compiler requirements : Ask permission before modifying repo-wide Gradle files unless the user requested widget creation, tile migration, or dependency setup. Set compileSdk = 37 or higher and enable buildFeatures { compose = true }. Keep the project's existing Android and Kotlin Gradle plugin declarations intact.

    dependencies { implementation("androidx.glance.wear:wear:{GLANCE_WEAR_VERSION}") implementation("androidx.glance.wear:wear-core:{GLANCE_WEAR_VERSION}") implementation("androidx.glance.wear:wear-tooling-preview:{GLANCE_WEAR_VERSION}") implementation("androidx.compose.remote:remote-creation-compose:{COMPOSE_REMOTE_VERSION}") implementation("androidx.compose.remote:remote-creation:{COMPOSE_REMOTE_VERSION}") implementation("androidx.compose.remote:remote-core:{COMPOSE_REMOTE_VERSION}") implementation("androidx.compose.remote:remote-tooling-preview:{COMPOSE_REMOTE_VERSION}") implementation("androidx.wear.compose.remote:remote-material3:{WEAR_COMPOSE_REMOTE_VERSION}") }

Codebase exploration

  1. Search the module for existing TileService, Material3TileService, or GlanceWearWidget implementations, <service> entries in app/src/main/AndroidManifest.xml, and @drawable/ preview assets under app/src/main/res/.
  2. When migrating an existing tile or modifying an unfamiliar multi-module project, run ./gradlew :app:assembleDebug to verify baseline build health.

Workflow

Step 1: Configure AndroidManifest.xml and provider XML

Register the GlanceWearWidgetService subclass in app/src/main/AndroidManifest.xml with the BIND_TILE_PROVIDER permission and BIND_WIDGET_PROVIDER intent action. Attach <meta-data> pointing to an @xml/ <wearwidget-provider> resource with SMALL and LARGE <container> entries. When configuring the service, provider XML, or legacy TileService migration, you MUST follow Widget service and manifest reference.

<service
    android:name=".snippets.widget.skill.MyWidgetService"
    android:exported="true"
    android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER">
    <intent-filter>
        <action android:name="androidx.glance.wear.action.BIND_WIDGET_PROVIDER" />
    </intent-filter>
    <meta-data
        android:name="androidx.glance.wear.widget.provider"
        android:resource="@xml/my_widget_info" />
</service>

Step 2: Implement GlanceWearWidget and GlanceWearWidgetService

Extend GlanceWearWidget and override provideWidgetData returning WearWidgetDocument. Annotate the GlanceWearWidgetService subclass with @AssociateWithGlanceWearWidget for static provider resolution:

// WRONG: Mobile GlanceAppWidget API (don't use on Wear OS)
class BrokenWidget : GlanceAppWidget() {
    override suspend fun provideGlance(context: Context, id: GlanceId) {}
}

// CORRECT: Wear OS GlanceWearWidget + GlanceWearWidgetService
@AssociateWithGlanceWearWidget(MyWidget::class)
class MyWidgetService : GlanceWearWidgetService() {
    override val widget: GlanceWearWidget = MyWidget()
}

class MyWidget : GlanceWearWidget() {
    override suspend fun provideWidgetData(
        context: Context,
        params: WearWidgetParams,
    ): WearWidgetData =
        WearWi
자주 묻는 질문

Gradle 파일을 알아서 바꾸나요?

전체 프로젝트의 Gradle 파일을 바꾸기 전에는 허락을 구합니다. 다만 위젯 생성이나 의존성 설정을 요청했다면 예외입니다.

라이브러리 버전은 어떻게 찾나요?

사용 가능한 조회 도구나 공식 Google Maven 메타데이터를 사용하며, 의존성 명령을 실행하지는 않습니다.

알파나 베타 버전도 지원하나요?

네. 아직 안정 버전이 없다면 알파, 베타, 릴리스 후보 버전을 사용할 수 있습니다.

상세 정보

작성자의 원본 설명

Create, migrate, update, and verify Wear OS widgets using Glance Wear and Remote Compose in an Android project. Use this skill when implementing GlanceWearWidget, GlanceWearWidgetService, WearWidgetDocument, Remote Compose UI primitives (RemoteColumn, RemoteRow, RemoteBox, RemoteText, RemoteImage, RemoteButton), local state with rememberMutableRemoteInt and valueChange, click actions with pendingIntentAction, widget provider XML containers (SMALL and LARGE), rectangular widget picker PNG previews, or migrating legacy ProtoLayout TileService tiles to Wear OS widgets. Don't use for mobile home s

repo: android/skills

인기도

GitHub 스타
10k
순위
#11940
라이선스
Apache-2.0
업데이트
2026. 10. 29.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬