PlaceListMapTemplate.Builder()....setOnContentRefreshListener{// Execute any desired logic...// Then call invalidate() so onGetTemplate() is called againinvalidate()}.build()
Java
newPlaceListMapTemplate.Builder()....setOnContentRefreshListener(()->{// Execute any desired logic...// Then call invalidate() so onGetTemplate() is called againinvalidate();}).build();
새로고침 버튼은 리스너에 값이 있는 경우에만 PlaceListMapTemplate의 헤더에 표시됩니다.
사용자가 새로고침 버튼을 클릭하면 OnContentRefreshListener 구현의 onContentRefreshRequested 메서드가 호출됩니다. onContentRefreshRequested 내에서 Screen.invalidate 메서드를 호출합니다. 그러면 호스트는 앱의 Screen.onGetTemplate 메서드를 다시 호출하여, 새로고침된 콘텐츠가 포함된 템플릿을 가져옵니다. 템플릿 새로고침에 관한 자세한 내용은 템플릿 콘텐츠 새로고침을 참고하세요. onGetTemplate에서 반환된 다음 템플릿이 동일한 유형인 경우 새로고침으로 집계되며 템플릿 할당량에 포함되지 않습니다.
앱 작업을 사용하여 Google 어시스턴트와 통합
어시스턴트를 사용하여 관심 장소 앱을 음성으로 사용 설정하면 사용자가 "Hey Google, ExampleApp에서 근처 충전소 찾아 줘"와 같이 말하여 관심 장소를 검색할 수 있습니다. 자세한 내용은 자동차용 앱 작업을 참고하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-09(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"]],["최종 업데이트: 2025-08-09(UTC)"],[],[],null,["# Build a point of interest app\n\nThis guide details the different features of the Car App Library\nthat you can use to implement the functionality of your point of interest (POI)\napp.\n\nDeclare category support in your manifest\n-----------------------------------------\n\nYour app needs to declare the `androidx.car.app.category.POI`\n[car app category](/training/cars/apps#supported-app-categories) in the intent filter of its\n[`CarAppService`](/reference/androidx/car/app/CarAppService).\n| **Important:** As of Car App Library version 1.3, the `androidx.car.app.category.PARKING` and `androidx.car.app.category.CHARGING` [car app categories](/training/cars/apps#supported-app-categories) are deprecated. Use the `androidx.car.app.category.POI` category instead.\n\nThe following example shows how to declare the app category: \n\n \u003capplication\u003e\n ...\n \u003cservice\n ...\n android:name=\".MyCarAppService\"\n android:exported=\"true\"\u003e\n \u003cintent-filter\u003e\n \u003caction android:name=\"androidx.car.app.CarAppService\" /\u003e\n \u003ccategory android:name=\"androidx.car.app.category.POI\"/\u003e\n \u003c/intent-filter\u003e\n \u003c/service\u003e\n ...\n \u003capplication\u003e\n\nAccess the map templates\n------------------------\n\nPOI apps can access the [`PlaceListMapTemplate`](/reference/androidx/car/app/model/PlaceListMapTemplate)\nand [`MapWithContentTemplate`](/reference/androidx/car/app/navigation/model/MapWithContentTemplate).\n\nThe `PlaceListMapTemplate` is specifically designed for showing a list of the\nPOIs alongside a map that is rendered by the host.\n\nThe `MapWithContentTemplate` can be used to display lists and other types of\ncontent alongside a map that is rendered by your app. See\n[Draw maps](/training/cars/apps#draw-maps) for more details on using this\ntemplate.\n\nTo access these templates, your app needs to declare the\n`androidx.car.app.MAP_TEMPLATES` permission in its `AndroidManifest.xml` file: \n\n \u003cmanifest ...\u003e\n ...\n \u003cuses-permission android:name=\"androidx.car.app.MAP_TEMPLATES\"/\u003e\n ...\n \u003c/manifest\u003e\n\n| **Note:** The `PlaceListMapTemplate` is available for use only by apps declaring the `androidx.car.app.category.POI` category or the deprecated `androidx.car.app.category.PARKING` or `androidx.car.app.category.CHARGING` categories. For navigation apps, see [Access the navigation templates](/training/cars/apps/navigation#access-navigation-templates).\n\nRefresh PlaceListMapTemplate content\n------------------------------------\n\nYou can let drivers refresh content with the tap of a button while browsing\nlists of places built with\n[`PlaceListMapTemplate`](/reference/androidx/car/app/model/PlaceListMapTemplate).\nImplement the\n[`OnContentRefreshListener`](/reference/androidx/car/app/model/OnContentRefreshListener)\ninterface's [`onContentRefreshRequested`](/reference/androidx/car/app/model/OnContentRefreshListener#onContentRefreshRequested())\nmethod, and use\n[`PlaceListMapTemplate.Builder.setOnContentRefreshListener`](/reference/kotlin/androidx/car/app/model/PlaceListMapTemplate.Builder#setoncontentrefreshlistener)\nto set the listener on the template to enable list refresh.\n\nThe following snippet shows how to set the listener on the template: \n\n### Kotlin\n\n```kotlin\nPlaceListMapTemplate.Builder()\n ...\n .setOnContentRefreshListener {\n // Execute any desired logic\n ...\n // Then call invalidate() so onGetTemplate() is called again\n invalidate()\n }\n .build()\n```\n\n### Java\n\n```java\nnew PlaceListMapTemplate.Builder()\n ...\n .setOnContentRefreshListener(() -\u003e {\n // Execute any desired logic\n ...\n // Then call invalidate() so onGetTemplate() is called again\n invalidate();\n })\n .build();\n```\n\nThe refresh button is only shown in the header of the\n`PlaceListMapTemplate` if the listener has a value.\n\nWhen the user clicks the refresh button, the `onContentRefreshRequested`\nmethod of your `OnContentRefreshListener` implementation is called. Within\n`onContentRefreshRequested`, call the\n[`Screen.invalidate`](/reference/androidx/car/app/Screen#invalidate())\nmethod. The host then calls back into your app's\n[`Screen.onGetTemplate`](/reference/androidx/car/app/Screen#onGetTemplate())\nmethod to retrieve the template with the refreshed content. See [Refresh the\ncontents of a template](/training/cars/apps#refresh-template) for more information about\nrefreshing templates. As long as the next template returned by `onGetTemplate`\nis of the same type, it is counted as a refresh and does not count toward the\ntemplate quota.\n\nIntegrate with Google Assistant using App Actions\n-------------------------------------------------\n\nVoice-enable your POI app using Assistant to allow users to search for points of\ninterest by asking things like, *\"Hey Google, find nearby charging stations on\nExampleApp\"* . For detailed instructions, see [App Actions for Cars](/guide/app-actions/cars).\n\n*** ** * ** ***"]]