Build a point of interest app

Stay organized with collections Save and categorize content based on your preferences.

This section details the different features of the library that you can make use of to implement the functionality of your point of interest (POI) app.

Declare category support in your manifest

Your app needs to declare the car app category in the intent filter of its CarAppService.

        <action android:name="" />
        <category android:name=""/>

Access the map template

Apps can access the PlaceListMapTemplate specifically designed for showing a list of points of interest alongside a map that is rendered by the host.

In order to get access to this template, your app needs to declare the permission in its AndroidManifest.xml:

<uses-permission android:name=""/>

Refresh PlaceListMapTemplate content

You can allow drivers to refresh content with the tap of a button while browsing lists of places built with PlaceListMapTemplate. Implement the OnContentRefreshListener interface's onContentRefreshRequested method and use PlaceListMapTemplate.Builder.setOnContentRefreshListener to set the listener on the template to enable list refresh.

The following snippet shows setting the listener on the template:


    .setOnContentRefreshListener {
        // Execute any desired logic
        // Then call invalidate() so onGetTemplate() is called again


new PlaceListMapTemplate.Builder()
        .setOnContentRefreshListener(() -> {
            // Execute any desired logic
            // Then call invalidate() so onGetTemplate() is called again

The refresh button is only shown in the header of the PlaceListMapTemplate if the listener has a value.

When the driver clicks the refresh button, the onContentRefreshRequested method of your OnContentRefreshListener implementation is called. Within onContentRefreshRequested, call the Screen.invalidate method. The host subsequently calls back into your app’s Screen.onGetTemplate method to retrieve the template with the refreshed content. See Refresh the contents of a template for more information about refreshing templates. As long as the next template returned by onGetTemplate is of the same type, it is counted as a refresh and is not counted towards the template quota.

Integrate with Google Assistant using App Actions

Voice-enable your POI app using Assistant to allow users to search for points of interest by asking things like, "Hey Google, find nearby charging stations on ExampleApp". For detailed instructions, see App Actions for Cars.