Maps are central to every 6amTech platform: customers drop a pin for their address, stores and providers set their location, zones are drawn on a map, and drivers and delivery men navigate and get tracked. When Maps fail, nothing works, and when they're set up carelessly, the bill can surprise you. Here's how we configure Google Maps Platform for 6amMart, DriveMond, Demandium and 6Valley.
Which APIs are involved
Exact requirements depend on your script and version, so check the docs. Typically you'll enable:
- Maps SDK for Android and Maps SDK for iOS to show maps in the apps.
- Maps JavaScript API for the map in the admin panel (zones, store locations) and the website.
- Places API for address search and autocomplete.
- Geocoding API to turn coordinates into addresses and back.
- Distance Matrix API and/or Directions API (or the newer Routes API) to calculate distances, delivery fees, fares and routes.
Enable only what your version actually calls. Every enabled API is another possible source of cost.
Step 1: create a Google Cloud project with billing
Create a project in Google Cloud Console in your own company's account, not a freelancer's. Link a billing account. Maps Platform requires billing to be active even if your usage stays within the free allowance. Pricing and free allowances change over time, so check Google's current Maps Platform pricing page for each API you use.
Step 2: separate keys for separate jobs
Use different keys for different places, each restricted properly:
- Android key: restricted to Android apps, with each app's package name and SHA-1 signing fingerprint. Include both the upload key and the Play App Signing key fingerprints, or maps will fail in the store build.
- iOS key: restricted to iOS apps, with each bundle ID.
- Browser key for the admin panel and website: restricted to websites, with your domains.
- Server key for backend calls such as distance and geocoding from the Laravel API: restricted by your server's IP address.
Also restrict each key to only the APIs it needs. 6amTech admin panels usually ask for a client-side and a server-side map key. Put the browser key and the server key in the matching fields.
Step 3: where the keys go
- Admin panel: the map API settings page, with client and server keys.
- Android apps: the
com.google.android.geo.API_KEYmetadata in the Android manifest. - iOS apps: the key passed to Google Maps services in the iOS app delegate.
- Website: usually read from the admin settings, but check your version.
After changing keys in the apps, rebuild them. Keys are compiled into the build.
Step 4: set budgets and quotas
Before launch:
- Set a budget alert on the billing account, with emails at several thresholds.
- Set daily quotas per API in the Cloud Console, so a bug or an abusive client can't run up unlimited calls.
- Check the Maps Platform metrics weekly at first to see which APIs are actually used.
Step 5: reduce calls without hurting the product
- Autocomplete sessions. Make sure place autocomplete uses session tokens if your version supports it, so a search plus selection is billed as one session.
- Don't geocode repeatedly. Saved customer addresses should store coordinates rather than geocoding again on every order.
- Location update intervals. In driver and delivery apps, sensible intervals and distance filters balance tracking accuracy against battery and server load.
- Static maps for order history screens instead of interactive maps, where the code allows.
Some of these are configuration and some are small code optimisations worth doing once order volume grows.
Troubleshooting: map not showing or blank grey map
- Android release build only: the SHA-1 of the Play App Signing key is missing from the key restriction.
- "This page can't load Google Maps correctly" in the admin panel: the browser key restriction doesn't include your domain, or the Maps JavaScript API isn't enabled.
- Address search returns nothing: the Places API isn't enabled, or the key restriction blocks it.
- Distance or delivery fee is zero: the server key is wrong, IP-restricted to the wrong address, or the Distance Matrix or Routes API isn't enabled.
- Everything broke suddenly: billing failed or a quota was reached. Check the billing account first.
Ownership and access
Keep the Google Cloud project, billing account and API keys in your company's name, with at least two people from your company as owners. If a freelancer or agency sets it up, add them as a user with limited permissions, and remove access when the work is done. Losing access to the project that holds your production keys is a painful way to find out who owned it.
How we help
Maps setup, key restriction and budget alerts are part of every installation we do for ride-hailing, delivery and home services platforms. See also our DriveMond setup guide.
Questions
Why is the map blank in my 6amMart app?
Most often the Android key restriction is missing the SHA-1 fingerprint of the Play App Signing key, or the Maps SDK isn't enabled for the key.
Which Google Maps APIs does 6amMart need?
Typically the Maps SDKs for Android and iOS, Maps JavaScript, Places, Geocoding, and Distance Matrix or Directions/Routes. Check your version's docs.
How do I prevent a huge Google Maps bill?
Restrict every key, set daily quotas per API, set budget alerts, and reduce repeated geocoding and autocomplete calls.
Should I use one API key for everything?
No. Use separate keys for Android, iOS, browser and server, each restricted to its platform and only the APIs it needs.