If you would like to upgrade to a newer long-term support version of Studio Pro, see Moving from Mendix Studio Pro 8 to 9.
Set Up Maps in Native Mobile Apps
Introduction
The Maps module allows you to work with maps. Consult the instructions below to include map capabilities in your native mobile apps.
Prerequisites
- Complete the Prerequisites section of How to Build a Mendix Native App in the Cloud
- Create an app on the Google Cloud Console and have Google Maps enabled for Android (and iOS, if you wish to use Google Maps on iOS as well) and also posses an API key.
- Before you can start using the Google Maps Platform APIs and SDKs, you must sign up and create a billing account.
- Install Mendix Studio Pro 8.15.0 and above to use the Native Mobile App Builder
Setting Up App Deep Linking
Make sure you have app containing the Maps module. This is a core module, so it is available in the Widgets panel. You can either add it to an existing project or make a new project from scratch.
Configuring Map Provider
Next you will configure the Maps widget provider. You will have two choices: Default and Google Maps. Selecting Default will have your app use the default-enabled map on your device. This means using Google Maps on Android devices and Apple Maps on iOS devices. Selecting Google Maps as your Maps configuration will have only Google Maps used on both platforms:
-
Double-click your Maps widget and Selecting the Map tab.
-
Select either the Default or Google Maps provider:
Configuring Maps Capability
-
Set up a native template with the Native Mobile App Builder. This can be launched from the Project menu as shown in How to Build a Mendix Native App in the Cloud. Complete the wizard and configure the project’s details and tokens:
-
Once done with the wizard, select the Capabilities menu item:
-
Enable the maps capability. This exposes a set of configurations:
- As described in the Prerequisites section, the API key gives the maps widget access to Google Cloud services
- The Purpose for maps string is a specialized text that tells Apple why you need to use maps in your app (Apple requests explanation as maps use device location data)
- I want to use Apple Maps for iOS mirrors the decision explained in the Configuring Map Provider section above
-
Click the Save button.
-
Navigate to the build page then click Build.
pod install
once more