2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
미디어로 라디오 구현
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
라디오 UI는 독립된 앱으로 구현됩니다. 라디오 UI를 라디오 하드웨어에 통합하는 방법에 관한 안내는 라디오 구현에서 확인할 수 있습니다.
다음 섹션에서는 라디오 UI를 미디어와 통합하여 사용자가 단일 앱인 것처럼 미디어 소스 및 라디오와 상호작용할 수 있는 원활한 환경을 제공하는 방법을 설명합니다.
다음 다이어그램은 라디오 및 미디어의 참조 구현이 앱 전환 사용자 흐름을 구현하는 방법을 보여 줍니다.

그림 1. 미디어 소스 전환 사용자 흐름
라디오 및 미디어의 다른 앱 간에 원활하게 전환하기 위해 car-media-common
라이브러리는 미디어 소스 선택기를 시작하는 데 사용할 수 있는 Android 인텐트를 정의합니다. AOSP에서 이 선택기는 앱 런처에서 구현되며, 앱 시작을 위해 동일한 UI를 제공하지만 미디어 소스만 표시하도록 필터링됩니다.
OEM은 현재 앱 런처 구현을 그대로 사용하거나 맞춤 미디어 소스 선택기를 구현하도록 선택할 수 있습니다.
선택기는 다음 두 모드에서 작동할 수 있습니다.
- 정상 흐름. 선택기를 사용하면 선택한 소스가 미디어에 표시되므로 사용자가 콘텐츠를 둘러볼 수 있습니다.
- 전환으로. 선택기는 소스를 전환하는 데 사용되지만 미디어는 사용자에게 표시되지 않습니다. 홈페이지의 선택기 아이콘이 이에 해당됩니다. 소스를 선택하면 가장 최근의 이전 화면이 사용자에게 표시됩니다(이 경우 홈페이지).
미디어 소스 간 전환에 사용되는 인텐트는 MediaSource#getSourceSelectorIntent()
메서드에서 가져올 수 있습니다. 이 메서드는 위에서 설명한 각 흐름을 시작하기 위해 인텐트를 반환하는 popup
부울을 허용합니다.
실제 인텐트는 packages/apps/Car/libs/car-media-common/res/values/config.xml
에서 정의됩니다. 이 구성을 맞춤설정하려면 빌드 시간 오버레이를 사용합니다.
라디오 앱 대체
라디오 앱이 미디어 탐색 및 미디어 세션을 구현하면 앱 런처에 라디오가 표시됩니다. 사용자가 아이콘을 클릭할 때 미디어 시작을 방지하려면 두 가지 요소가 필요합니다. 라디오는 반드시 다음을 충족해야 합니다.
- 런처 활동이 있어야 합니다.
- 맞춤 소스로 선언되어야 합니다. 이렇게 하려면 구성요소 이름을
car-media-common/res/values/config.xml
의 custom_media_packages
키에 추가합니다.
UX 운전 제한
미디어는 모든 UX 운전자 주의 분산 행동 제한을 준수해야 합니다. 이렇게 하려면 미디어가 CarUXRestrictionManager를 수신 대기하고 모든 정책을 구현해야 합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2024-04-24(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-04-24(UTC)"],[],[],null,["# Implement radio with Media\n\nThe Radio UI is implemented as an independent app. Instructions on how to integrate a\nRadio UI to the radio hardware can be found at\n[Implement radio](/docs/automotive/broadcast-radio).\n\nThe following section describes how to integrate Radio UI with Media to provide users with a\nseamless experience that enables users to interact with media sources and radio as if they were a\nsingle app.\n\nMedia source switching user flow\n--------------------------------\n\nThe following diagram illustrates how the reference implementation of Radio and Media implements\nthe app switching user flow.\n\n**Figure 1.** Media source switching user flow\n\nTo provide a seamless transition between Radio and other apps in Media, the\n`car-media-common` library defines Android intents that can be used to launch a media\nsource selector. In AOSP, this selector is implemented in the App Launcher, presenting the same UI\nfor launching apps but filtered to display only media sources.\n\nOEMs can opt to take the current App Launcher implementation as is, or implement a customized\nmedia source selector.\n\nThe selector can act in two modes:\n\n- **Normal flow.** After using the selector, the selected source is displayed in Media so the user can browse its content.\n- **As a switch.** A selector is used to switch sources, but the media is not displayed to the user. This is true of the Selector icon on the Home Page. After selecting a source, the most recent previous screen is displayed to the user (in this case, the Home page).\n\nThe intent used to switch between media sources can be obtained from the\n`MediaSource#getSourceSelectorIntent()` method, which accepts a `popup`\nBoolean that returns an intent to launch each of the flows described above.\n\nThe actual intents are defined at\n`packages/apps/Car/libs/car-media-common/res/values/config.xml`. To\ncustomize this configuration, use build-time overlays.\n\n### Replace the Radio app\n\nGiven that the Radio app implements Media Browse and Media Session, Radio is displayed\nin the App launcher. To prevent launching Media when a user clicks the icon, two elements\nare required. Radio *must*:\n\n- Have a *launcher* activity.\n- Be declared as a *custom source* . To do so, add the component name to the `custom_media_packages` key in `car-media-common/res/values/config.xml`.\n\nUX driving restrictions\n-----------------------\n\nMedia must observe all UX driving distraction restrictions. To do so, Media must listen to the\n[CarUXRestrictionManager](https://developer.android.com/reference/android/car/drivingstate/CarUxRestrictionsManager)\nand implement all its policies.\n\n- Media must connect to the [Car](https://developer.android.com/reference/android/car/Car) library and get an instance of [CarUXRestrictionManager](https://developer.android.com/reference/android/car/drivingstate/CarUxRestrictionsManager).\n- Media must subscribe to updates in the list of [CarUxRestrictions](https://developer.android.com/reference/android/car/drivingstate/CarUxRestrictions) and implement them as documented.\n- Particularly important for Media are:\n - [UX_RESTRICTIONS_NO_SETUP](https://developer.android.com/reference/android/car/drivingstate/CarUxRestrictions.html#UX_RESTRICTIONS_NO_SETUP). In this case, the sign-in flow must be disabled.\n - [UX_RESTRICTIONS_LIMIT_STRING_LENGTH](https://developer.android.com/reference/android/car/drivingstate/CarUxRestrictions.html#UX_RESTRICTIONS_LIMIT_STRING_LENGTH). Error messages and other text provided by the media apps must be limited to the given length."]]