SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Display Customer Locations Using a Fiori Map Control

Further customize the generated app to display customer locations on a map and try out the features of the Fiori Map control, including the toolbar, map panel, clustering, and map annotation.

Overview

🎓 beginner 90 min. SAP BTP Sdk For AndroidBeginnerAndroidMobileSAP Business Technology Platform

You will learn

  • How to add a Google Map to the wizard-generated app and display customer locations
  • How to add a Fiori Map control and try out its features
Bruce Meng B Bruce Meng January 7, 2026
Created by April 26, 2024
Contributors

Prerequisites

Prerequisites

You have:

  1. Set Up a BTP Account for Tutorials. Follow the instructions to get an account, and then to set up entitlements and service instances for the following BTP services.
    • SAP Mobile Services
  2. Completed Try Out SAP BTP SDK Wizard for Android.

Steps

Intro

A Fiori Map control extends the Google Maps SDK for Android. It provides additional APIs that handle clustering, as well as a toolbar, panel, and an editor to annotate map. For additional details, see Fiori Design Guidelines.


Step 1 Create a new screen to display a map

In this section you will create a new activity to display a map.

  1. In Android Studio, in the AndroidManifest.xml file, add the following content as a child of the <application> tag right before <activity> tags:

    XML
    <!--
        TODO: Before you run your application, you need a Google Maps API key.
    
        To get one, follow the directions here:
    
        https://developers.google.com/maps/documentation/android-sdk/get-api-key
    
        Once you have your API key (it starts with "AIza"), define a new property in your
        project's local.properties file (e.g. MAPS_API_KEY=Aiza...).
    -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="${MAPS_API_KEY}" />
  2. Follow the directions mentioned in the above comments to obtain an API key.

  3. Open the local.properties file in your project-level directory and then add the following code. Replace YOUR_API_KEY with your API key.

    Code
    MAPS_API_KEY=YOUR_API_KEY
  4. In Android Studio, in the top-level build.gradle file, add the following code to the dependencies element under buildscript.

    Gradle
    buildscript {
        dependencies {
            // ...
            classpath("com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1")
        }
    }
  5. Open the module-level build.gradle file and add the following code to the plugins element.

    Gradle
    plugins {
        id("com.android.application")
        // ...
        id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
    }
  6. Add the following dependency to the module-level build.gradle file and click Sync Now to sync the project:

    Gradle
    dependencies {
        // Android Maps Compose composables for the Maps SDK for Android
        implementation("com.google.maps.android:maps-compose:6.12.2")
    
        ... ...
    }
  7. In the project explorer, navigate to app > kotlin+java > com.sap.wizapp > ui > odata > screens > customer.

  8. Right-click and choose New > Kotlin Class / File.

  9. Name the file as CustomersMapScreen. Select File and then press Enter.

  10. Replace the content of CustomersMapScreen with the following:

    Kotlin
    package com.sap.wizapp.ui.odata.screens.customer
    
    import androidx.compose.foundation.layout.fillMaxSize
    import androidx.compose.runtime.Composable
    import androidx.compose.ui.Modifier
    import com.google.android.gms.maps.model.CameraPosition
    import com.google.android.gms.maps.model.LatLng
    import com.google.maps.android.compose.GoogleMap
    import com.google.maps.android.compose.Marker
    import com.google.maps.android.compose.rememberCameraPositionState
    import com.google.maps.android.compose.rememberMarkerState
    import com.sap.wizapp.ui.odata.viewmodel.ODataViewModel
    
    val CustomersMapScreen:
            @Composable
                (
                navigateToHome: () -> Unit,
                navigateUp: () -> Unit,
                viewModel: ODataViewModel<EntityValue>,
                isExpandScreen: Boolean,
            ) -> Unit =
        { _, _, _, _ ->
            val sydney = LatLng(-33.865143, 151.209900)
            val sydneyMarkerState = rememberMarkerState(position = sydney)
            val cameraPositionState = rememberCameraPositionState {
                position = CameraPosition.fromLatLngZoom(sydney, 1f)
            }
            GoogleMap(
                modifier = Modifier.fillMaxSize(),
                cameraPositionState = cameraPositionState
            ) {
                Marker(
                    state = sydneyMarkerState,
                    title = "Sydney",
                    snippet = "Marker in Sydney"
                )
            }
        }
  11. On Windows, press Ctrl+Shift+N, or, on a Mac, press command+shift+O, and type ODataCommonUI to open ODataCommonUI.kt.

  12. On Windows, press Ctrl+F, or, on a Mac, press command+F, and search for CustomerEntitiesScreen.

  13. Replace CustomerEntitiesScreen with CustomersMapScreen so that when the user taps on Customers, the app will navigate to the newly added screen that includes a map.

  14. Run the app. Select Customers.

    Entities screen
    Entities screen

    Instead of a customer list, a map is now displayed.

    Map screen
    Map screen

    If a message appears that says Wiz App is having trouble with Google Play services, try running the app on an Android emulator that includes the Google Play Store app.

Step 2 Populate the map with customer locations
+
Step 3 Implement navigation to the customer details screen
+
Step 4 Enhance the app to use the Fiori Map control
+
Step 5 Implement the map panel
+
Step 6 Implement settings
+
Step 7 Enable annotating
+
Step 8 Customize map markers and legend
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 8
1. Create a new screen to display a map 2. Populate the map with customer locations 3. Implement navigation to the customer details screen 4. Enhance the app to use the Fiori Map control 5. Implement the map panel 6. Implement settings 7. Enable annotating 8. Customize map markers and legend

Learn more →