2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
위젯 및 바로가기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Android 8.0에 바로가기 및 위젯을 추가하는 데 사용되는 새로운 Flow API는 앱 개발자가 위젯 트레이에 의존하는 대신 앱 내부에서 바로가기와 위젯을 추가할 수 있게 해줍니다. 또한 보안을 이유로 바로가기 추가를 위한 기존 방식(브로드캐스트 전송)이 지원 중단됩니다.
런처는 앱 개발자가 바로가기나 위젯을 추가할 때 시스템을 신뢰할 수 있도록 이러한 새 구현을 지원해야 합니다.
예시 및 소스
문서는 다양한 시스템 클래스로 제공됩니다. 참조 문서는 다음과 같습니다.
- ShortcutManager.java
고정된 바로가기 섹션을 헤더에 게시합니다. - Intent.java
ACTION_CREATE_SHORTCUT을 위한 Javadoc입니다.
- AppWidgetManager.java
requestPinAppWidget의 Javadoc입니다.
구현
기기 구현자는 런처에 활동과 인텐트 필터 작업을 추가해야 합니다.
android.content.pm.action.CONFIRM_PIN_SHORTCUT
android.content.pm.action.CONFIRM_PIN_APPWIDGET
자세한 내용은 API 문서를 참고하세요.
이 활동은 요청된 위젯/바로가기를 추가하고, 수락 시 상응하는 위젯/바로가기를 홈 화면에 추가하라는 확인 메시지를 사용자에게 표시해야 합니다.
위젯의 경우 accept()
호출에는 새로 추가된 위젯의 위젯 ID가 포함되어야 합니다.
시스템 UI 구현
파트너는 Launcher3 구현(packages/apps/Launcher3
)을 참조하여 런처 앱을 업데이트해야 합니다.
Android 오픈소스 프로젝트(AOSP)에서 Launcher3 관련 변경사항을 찾습니다.
유효성 검사
기능의 유효성을 검사하려면 Chrome 또는 연락처 앱에서 바로가기를 추가하고 확인 메시지가 제대로 표시되는지 확인합니다. 수락 후에는 아이콘이 홈 화면에 추가되어야 하며 Chrome에 성공 토스트 메시지가 표시되어야 합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Widgets and shortcuts\n\nThe new flow API for adding shortcuts and widgets in Android 8.0 allows\napp developers to add shortcuts and widgets from inside the app instead\nof relying on the widget tray. It also deprecates the old method (sending a\nbroadcast) of adding shortcuts for security reasons.\n\n\nLaunchers need to support this new implementation so that app developers can\nrely on the system to add their shortcut or widget.\n\nExamples and source\n-------------------\n\n\nDocs are available in various system class. References include the following:\n\n- **[ShortcutManager.java](https://developer.android.com/reference/android/content/pm/ShortcutManager.html)** \n Publish Pinned shortcut section in header.\n- **Intent.java** \n Javadoc for ACTION_CREATE_SHORTCUT.\n- **AppWidgetManager.java** \n Javadoc for requestPinAppWidget.\n\nImplementation\n--------------\n\n\nDevice implementers need to add an activity in their launcher with intent filter actions:\n\n- `android.content.pm.action.CONFIRM_PIN_SHORTCUT`\n- `android.content.pm.action.CONFIRM_PIN_APPWIDGET`\n\n\nRefer to the [API\ndocumentation](https://developer.android.com/reference/android/content/pm/LauncherApps.html) for more details.\n\n\nThis activity should display a confirmation prompt to the user to add the [requested\nwidget/shortcut](https://developer.android.com/reference/android/content/pm/LauncherApps.html) and upon accepting, add the corresponding widget/shortcut on\nthe homescreen.\n\n\nIn case of widgets, the `accept()` call should include the widget ID\nof the newly added widget.\n\n### Implementing a System UI\n\n\nPartners need to update their Launcher app using the Launcher3 implementation\n(`packages/apps/Launcher3`) as reference.\n\n\nFind the relevant Launcher3 changes in the Android Open Source Project (AOSP):\n\n- Change-Id: [8b2002e28072c52d78f6d052c6ff6da50a2d0324](https://android.googlesource.com/platform/packages/apps/Launcher3/+/8b2002e28072c52d78f6d052c6ff6da50a2d0324)\n- Change-Id: [278359539c02ca160caf1df54ce96053a2a2ef59](https://android.googlesource.com/platform/packages/apps/Launcher3/+/278359539c02ca160caf1df54ce96053a2a2ef59)\n\nValidation\n----------\n\n\nTo validate the feature, try to add shortcuts from Chrome or the Contacts app\nand verify that a proper confirmation prompt is shown. Upon accepting, the icon\nshould get added on the homescreen and Chrome should display a success toast."]]