πŸ›’ Bringo

Delivery App

API URL & Maps Key

1. API base URL

Open lib/config/env.dart and set your backend URL:

static const String apiBase = String.fromEnvironment(
  'API_BASE',
  defaultValue: 'https://YOUR_DOMAIN.com',   // ← your live API
);
static const String apiPrefix = '/api/v1/partner';

You can also override it at build time without editing the file:

flutter build apk --release --dart-define=API_BASE=https://your-domain.com

A value passed with --dart-define always wins over the defaultValue in the file, so you can keep one source file and build for several environments.

Local development

Android emulator
http://10.0.2.2:8000 β€” the emulator's alias for your computer's localhost.
iOS simulator
http://localhost:8000 β€” the simulator shares the Mac's network stack.
Physical phone
Your computer's LAN IP, e.g. http://192.168.1.5:8000, phone on the same Wi-Fi. Rider testing almost always needs a real device (GPS), so this is the usual case.

Start the backend with php artisan serve --host=0.0.0.0 so it accepts connections from the phone. Your production URL must be https:// with a valid certificate β€” Android 9+ and iOS block plain http:// outside the debug build.

This app normalises a trailing slash on apiBase, so https://your-domain.com/ and https://your-domain.com both work here.

2. Google Maps key

The Delivery app uses maps for the rider's live location and navigation. Paste your key directly into android/app/src/main/AndroidManifest.xml (inside <application>) β€” no build flag needed:

<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="YOUR_ANDROID_MAPS_KEY"/>

For iOS, paste your Maps key in ios/Runner/AppDelegate.swift via GMSServices.provideAPIKey("YOUR_IOS_MAPS_KEY").

πŸ”’
Restrict the key to this app's package name + SHA-1 in Google Cloud and enable billing. See Google Maps.

3. Live-route / tracking map (admin key)

The live-route screen draws a static map image using the admin-managed key (Admin β†’ Settings β†’ Google API β†’ Google Maps API Key), not the build-time key above.

πŸ—ΊοΈ
That admin key's Google Cloud project must have Maps Static API enabled β€” a separate toggle from the JavaScript/native SDK APIs. If it's off, the tracking screens show a map error in the Customer and Delivery apps while every other map works. See Google Maps β†’ Troubleshooting.

If you would rather not depend on the admin setting during development, lib/config/env.dart also accepts a build-time fallback:

flutter run --dart-define=MAPS_STATIC_KEY=YOUR_STATIC_MAPS_KEY

The admin-panel value takes priority; this flag only fills in when the admin key is empty.

4. Location permissions

Rider tracking needs location access while the app is in the background β€” a delivery runs with the screen off. The permission strings ship configured, but you must justify them when you publish:

Android
ACCESS_FINE_LOCATION plus ACCESS_BACKGROUND_LOCATION in AndroidManifest.xml. Google Play requires a short background location declaration and a demo video showing why the app needs it β€” budget time for this review.
iOS
NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in ios/Runner/Info.plist. Edit the wording to name your brand; App Review rejects vague strings.

5. Verify the connection

  1. Run the app and sign in with a delivery partner account created in your admin panel (Admin → Delivery Partners).
  2. Go online with the duty toggle β€” the dashboard should show your own zones and pending orders.
  3. Check the backend log storage/logs/laravel.log for the incoming requests.
Login fails / connection refused
Wrong host, or the server is not reachable from the device. Open the URL in the phone's browser to confirm.
Signed in but no jobs appear
The rider is outside every deliverable zone, is off duty, or their KYC is not approved β€” all three gate dispatch.
Map blank / "development purposes only"
Maps key missing, unrestricted with billing off, or restricted to the wrong package/SHA.
πŸ‘‰
Next: Firebase & Push.