Google Maps Key in the Apps
Optional. The apps use free OpenStreetMap until you build them with a Google Maps key and choose Google Maps in the admin panel.
Optional step
Zipkart works with free OpenStreetMap out of the box. Do this page only if you chose Google Maps in Maps & API key.
The phone apps need the key inside the build to draw the native Google map. Without it they show OpenStreetMap, even when the admin panel says Google Maps. Nothing crashes.
1. Create the key#
In the Google Cloud Console, select your Firebase project, open APIs & Services → Library and enable:
| API | Used by | For |
|---|---|---|
| Maps SDK for Android | Customer, Store, Delivery Boy | The map in the Android apps |
| Maps SDK for iOS | Customer, Store, Delivery Boy | The map in the iPhone apps |
| Places API (New) | Customer, Store | Address search |
| Geocoding API | Customer | The street address of a pin |
| Routes API | Customer, Delivery Boy | The road route on the tracking map |
| Maps JavaScript API | Websites and panels | The map on the web |
Then APIs & Services → Credentials → Create credentials → API key, and copy it.
2. Put it in each app#
Add one line at the end of android/local.properties in the app folder (keep the lines already there):
MAPS_API_KEY=AIzaSy...your-key...
Create ios/Flutter/Secrets.xcconfig in the app folder with one line:
MAPS_API_KEY = AIzaSy...your-key...
Do it in customer, store and driver. Both files are ignored by Git, so your key is never pushed. On a new computer, create them again.
3. Rebuild#
The key is read only when the app is built. Hot reload is not enough: stop the app and run it again, or build a new APK, AAB or IPA.
4. Switch on Google Maps#
In the admin panel open SettingsAPI Credentials, choose Google Maps, paste the key and save. See Maps & API key.
Protect your key
Restrict the key to the APIs in the table above and set a budget alert in Google Cloud Billing. Do not add an Android-app or iOS-app restriction to the key you save in the admin panel: the apps call Places, Geocoding and Routes with it directly.