Google Maps Setup
Configure Google Maps for address selection, nearby restaurant discovery, and real-time order tracking.
Google Maps Setup
Configure Google Maps for address selection, nearby restaurant discovery, and real-time order tracking.
Table of Contents
Google Maps is a third-party service. You must create your own Google Cloud account and enable billing. This is not included in your CodeCanyon purchase.
Google provides a $200/month free credit for Maps Platform usage, which covers most small-to-medium apps. If your usage exceeds this credit, Google will charge you based on their published pricing.
The author of FoodFeast has no control over Google Maps pricing and is not responsible for any costs incurred.
Overview#
FoodFeast uses Google Maps for three core features: address selection when placing orders, nearby restaurant discovery on the home screen, and live order tracking during delivery.
The app integrates Google Maps through google_maps_flutter ^2.10.1 in pubspec.yaml.
APIs you need to enable#
| API | What it does in FoodFeast |
|---|---|
| Maps SDK for Android | Renders interactive maps in the Android app |
| Maps SDK for iOS | Renders interactive maps in the iOS app |
| Geocoding API | Converts GPS coordinates to human-readable addresses |
| Geolocation API | Determines the user's current location |
| Places API | Powers address autocomplete / search |
Enable the required APIs#
Open Google Cloud Console
Go to console.cloud.google.com and sign in. Create a new project or select an existing one.
Navigate to APIs & Services → Library
Search for and enable each of these 5 APIs:
- Maps SDK for Android
- Maps SDK for iOS
- Geocoding API
- Geolocation API
- Places API
Enable billing
Go to Billing in the sidebar and link a billing account. Google requires a billing account to be active even though $200/month in free usage is provided.
Create an API key#
Go to APIs & Services → Credentials
Click Create Credentials → API key. A new key is generated.
Restrict the key (recommended)
Click on the new key → Restrict key. Under "API restrictions", select Restrict key and check only the 5 APIs listed above. This prevents unauthorized usage.
Android configuration#
Locate the Android Manifest in your IDE
In your project's file explorer, navigate down to:
android/app/src/main/AndroidManifest.xml

Open the android folder

Check the project-level build.gradle
Confirm the Google Maps and Google Services Gradle plugins are present at the project level.

Open the app module

Drill into src/main
Continue navigating: app → src → main to reach the manifest file.

Add the API key meta-data tag
Inside the <application> tag, add:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_ANDROID_MAPS_KEY"/>
Replace YOUR_ANDROID_MAPS_KEY with your actual Google Maps API key.

Verify permissions
The manifest should already include these permissions (they come with the project):
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>iOS configuration#
Open AppDelegate.swift
ios/Runner/AppDelegate.swiftimport GoogleMaps
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: ...
) -> Bool {
GMSServices.provideAPIKey("YOUR_IOS_MAPS_KEY")
GeneratedPluginRegistrant.register(with: self)
return super.application(application, ...)
}
}
Replace YOUR_IOS_MAPS_KEY with your actual Google Maps API key.
Add location usage description
In ios/Runner/Info.plist, ensure these keys exist:
<key>NSLocationWhenInUseUsageDescription</key>
<string>FoodFeast needs your location to find nearby restaurants and deliver to you.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>FoodFeast uses your location for live order tracking.</string>Backend configuration#
The Laravel backend uses a Google Maps API key server-side for distance calculation and delivery fee computation.
Add the key to your .env file
backend/.env
GOOGLE_MAPS_API_KEY="YOUR_SERVER_MAPS_KEY"
This key should ideally be a separate server-restricted key (restrict by IP address of your hosting server).
Test & troubleshoot#
Run the app and open the location/map screen
If you see the interactive map with markers, your setup is correct.
Common issues#
| Problem | Solution |
|---|---|
| Grey grid instead of map | API key is missing or invalid. Verify the key in AndroidManifest.xml / AppDelegate.swift. Also check that Maps SDK for Android/iOS is enabled in Google Cloud Console. |
| Map loads but no autocomplete | Enable the Places API in Google Cloud Console. |
| Map works but address shows as coordinates | Enable the Geocoding API in Google Cloud Console. |
| "This API project is not authorized" | You restricted the key to specific APIs — make sure all 5 required APIs are included in the restriction. |
| Emulator shows no map | Some emulators lack Google Play Services. Test on a physical device or use an emulator with Google APIs system image. |