-
Go to Google Cloud Console
- Visit: https://console.cloud.google.com/
- Sign in with your Google account
-
Create a New Project
- Click on the project dropdown at the top (next to "Google Cloud")
- Click "New Project"
- Enter project details:
- Project name:
OOUTH Coop Maps(or any name you prefer) - Organization: (Leave as default if you don't have one)
- Location: (Leave as default)
- Project name:
- Click "Create"
- Wait for the project to be created (takes a few seconds)
-
Select Your New Project
- Click the project dropdown again
- Select your newly created project
-
Set up Billing Account
- In the left sidebar, click "Billing"
- Click "Link a billing account"
- If you don't have one, click "Create billing account"
- Fill in your payment information
- Note: Google provides $200/month free credit, so you likely won't be charged unless you exceed this
-
Link Billing to Project
- Select your billing account
- Click "Set account"
-
Open API Library
- In the left sidebar, click "APIs & Services" → "Library"
- Or visit: https://console.cloud.google.com/apis/library
-
Enable Maps JavaScript API (For Admin Panel/Web)
- Search for "Maps JavaScript API"
- Click on it
- Click "Enable" button
- Wait for it to enable
-
Enable Maps SDK for Android (For Android App)
- Search for "Maps SDK for Android"
- Click on it
- Click "Enable" button
-
Enable Maps SDK for iOS (For iOS App)
- Search for "Maps SDK for iOS"
- Click on it
- Click "Enable" button
-
Enable Geocoding API (Optional but recommended)
- Search for "Geocoding API"
- Click on it
- Click "Enable" button
-
Go to Credentials
- In the left sidebar, click "APIs & Services" → "Credentials"
- Or visit: https://console.cloud.google.com/apis/credentials
-
Create API Key
- Click "Create Credentials" → "API Key"
- Your API key will be generated immediately
- Copy this key - you'll need it in the next steps
- It will look like:
AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
Restrict the API Key (IMPORTANT for security)
For Web/Admin Panel:
- Click on your API key to edit it
- Under "Application restrictions", select "HTTP referrers (web sites)"
- Click "Add an item"
- Add your domain(s):
https://www.emmaggi.com/*https://emmaggi.com/*http://localhost:*(for local testing)
- Under "API restrictions", select "Restrict key"
- Check only:
- Maps JavaScript API
- Geocoding API (if enabled)
- Click "Save"
For Android App:
- Create a separate API key OR use the same one with multiple restrictions
- Under "Application restrictions", select "Android apps"
- Click "Add an item"
- Enter:
- Package name:
com.emmaggi.oouthcoop - SHA-1 certificate fingerprint: (Get this in Step 5)
- Package name:
- Under "API restrictions", select "Restrict key"
- Check only:
- Maps SDK for Android
- Geocoding API (if enabled)
- Click "Save"
For iOS App:
- Create a separate API key OR use the same one with multiple restrictions
- Under "Application restrictions", select "iOS apps"
- Click "Add an item"
- Enter:
- Bundle identifier:
com.emmaggi.oouthcoop(check your iOS project)
- Bundle identifier:
- Under "API restrictions", select "Restrict key"
- Check only:
- Maps SDK for iOS
- Geocoding API (if enabled)
- Click "Save"
-
Open Terminal/Command Prompt
- Navigate to your Android project directory
-
Get Debug SHA-1 (For testing)
cd oouth_coop_app/android ./gradlew signingReport- Look for
SHA1:in the output underVariant: debug - Copy the SHA-1 value (looks like:
AA:BB:CC:DD:...)
- Look for
-
Get Release SHA-1 (For production)
- If you have a keystore file, use:
keytool -list -v -keystore /path/to/your/keystore.jks -alias your-key-alias
- Enter your keystore password
- Copy the SHA-1 value
-
Add SHA-1 to API Key Restrictions
- Go back to Google Cloud Console → Credentials
- Edit your Android API key
- Add both debug and release SHA-1 fingerprints
Replace YOUR_GOOGLE_MAPS_API_KEY_HERE with your actual API key in these files:
-
coop_admin/event-management.php (Line 162)
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE&libraries=places"></script>
-
coop_admin/event-details.php (Line 250)
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE"></script>
-
oouth_coop_app/android/app/src/main/AndroidManifest.xml (Line ~48)
<meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR_API_KEY_HERE" />
-
oouth_coop_app/ios/Runner/AppDelegate.swift (Line 9)
GMSServices.provideAPIKey("YOUR_API_KEY_HERE")
- Open
event-management.phpin your browser - Click "Create Event"
- Click "Select on Map" or "Use My Location"
- Map should load without errors
- Run
flutter pub getin your app directory - Build and run the app
- Navigate to Events tab
- Open an event and check if map loads
- Try checking in to an event
-
"This API key is not authorized"
- Check if you've enabled the correct APIs
- Verify API key restrictions match your domain/app
-
"RefererNotAllowedMapError"
- Add your domain to HTTP referrer restrictions
- Include both
wwwand non-wwwversions
-
"API key not valid"
- Double-check you copied the entire key
- Ensure no extra spaces or characters
-
Maps not loading on mobile
- Verify SHA-1 fingerprint is correct
- Check bundle ID matches exactly
- Ensure Maps SDK APIs are enabled
- Free Tier: $200/month credit
- Maps JavaScript API: $7 per 1,000 loads
- Maps SDK (Android/iOS): $7 per 1,000 loads
- Geocoding API: $5 per 1,000 requests
With $200 credit, you get approximately:
- ~28,500 map loads per month FREE
- ~40,000 geocoding requests per month FREE
- ✅ Always restrict your API keys
- ✅ Use separate keys for web, Android, and iOS
- ✅ Monitor usage in Google Cloud Console
- ✅ Set up billing alerts
- ✅ Rotate keys periodically
- ✅ Never commit API keys to public repositories
- Google Cloud Console: https://console.cloud.google.com/
- API Library: https://console.cloud.google.com/apis/library
- Credentials: https://console.cloud.google.com/apis/credentials
- Billing: https://console.cloud.google.com/billing
- Maps Platform Pricing: https://mapsplatform.google.com/pricing/