이 페이지에서는 자동차 앱 라이브러리를 설치하고 앱의 매니페스트 파일을 구성하는 방법을 설명합니다.
자동차 앱 라이브러리 설치
앱에 라이브러리를 추가하려면 Jetpack 라이브러리 출시 페이지를 참고하세요.
앱의 매니페스트 파일 구성
자동차 앱을 만들려면 먼저 앱의 매니페스트 파일을 구성해야 합니다.
CarAppService 선언
호스트는 CarAppService 구현을 통해 앱에 연결됩니다.
매니페스트에서 이 서비스를 선언하면 호스트에서 앱을 검색하여 연결할 수 있습니다.
앱 인텐트 필터의 <category> 요소에서 앱의 카테고리도 선언해야 합니다. 이 요소에 허용되는 값은 지원되는 앱 카테고리 목록을 참고하세요.
다음 코드 스니펫은 매니페스트에서 관심 장소 앱의 자동차 앱 서비스를 선언하는 방법을 보여줍니다.
<application>
...
<service
...
android:name=".MyCarAppService"
android:exported="true">
<intent-filter>
<action android:name="androidx.car.app.CarAppService"/>
<category android:name="androidx.car.app.category.POI"/>
</intent-filter>
</service>
...
<application>
지원되는 앱 카테고리
CarAppService 선언에 설명된 대로 CarAppService를 선언할 때 인텐트 필터에 이러한 값 중 하나 이상을 추가하여 앱의 카테고리도 선언해야 합니다.
androidx.car.app.category.NAVIGATION: 내비게이션 세부 경로 안내를 제공합니다. 자동차용 내비게이션 앱 빌드를 참고하세요.androidx.car.app.category.POI: 주차 공간, 충전소, 주유소와 같은 관심 장소를 찾는 데 관련된 기능을 제공합니다. 자동차용 관심 장소 앱 빌드를 참고하세요.androidx.car.app.category.IOT: 사용자가 차 안에서 연결된 기기를 대상으로 관련 작업을 실행할 수 있습니다. 자동차용 사물 인터넷 앱 빌드를 참고하세요.androidx.car.app.category.WEATHER: 사용자가 현재 위치 또는 경로와 관련된 관련 날씨 정보를 볼 수 있습니다. 자동차용 날씨 앱 빌드를 참고하세요.androidx.car.app.category.MEDIA: 사용자가 자동차에서 음악, 라디오, 오디오북 및 기타 오디오 콘텐츠를 탐색하고 재생할 수 있습니다. 자동차용 템플릿 미디어 앱 빌드를 참고하세요.androidx.car.app.category.MESSAGING: 사용자가 짧은 형식의 문자 메시지로 소통할 수 있습니다. Android Auto용 템플릿 메시지 환경 빌드를 참고하세요.androidx.car.app.category.CALLING: 사용자가 음성 통화로 통신할 수 있습니다. Android Auto용 통화 환경 빌드를 참고하세요.
각 카테고리에 대한 자세한 설명과 카테고리 자격 요건은 자동차용 Android 앱 품질을 참고하세요.
앱 이름 및 아이콘 지정
시스템 UI에서 앱을 나타내려면 carPermissionActivityLayout가 호스트의 앱 이름과 아이콘을 지정해야 합니다. CarAppService의 label 및 icon 속성을 사용하여 호스트가 앱을 표시하는 데 사용하는 앱 이름과 아이콘을 지정합니다.
...
<service
android:name=".MyCarAppService"
android:exported="true"
android:label="@string/my_app_name"
android:icon="@drawable/my_app_icon">
...
</service>
...
<service> 요소에서 라벨이나 아이콘을 선언하지 않으면 호스트는 <application> 요소에 지정된 값으로 대체합니다.
맞춤 테마 설정하기
자동차 앱의 맞춤 테마를 설정하려면 다음 단계를 따르세요.
매니페스트 파일에
<meta-data>요소를 추가합니다.<meta-data android:name="androidx.car.app.theme" android:resource="@style/MyCarAppTheme />스타일 리소스를 선언하여 맞춤 자동차 앱 테마의 속성을 설정합니다.
<resources> <style name="MyCarAppTheme"> <item name="carColorPrimary">@color/my_primary_car_color</item> <item name="carColorPrimaryDark">@color/my_primary_dark_car_color</item> <item name="carColorSecondary">@color/my_secondary_car_color</item> <item name="carColorSecondaryDark">@color/my_secondary_dark_car_color</item> <item name="carPermissionActivityLayout">@layout/my_custom_background</item> </style> </resources>