The Maps module allows you to work with maps. Consult the instructions below to include map capabilities in your native mobile apps.
- Complete the Prerequisites section of How to Deploy Your First Mendix Native Mobile App
- 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 v8.15.0 and above to use the Native Mobile App Builder
3 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.
3.1 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:
3.2 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 Deploy Your First Mendix Native Mobile App. 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.
When running locally from source, on iOS you have to run
pod install once more