DEEPLINKX / app

Google Maps

Google Maps actions, setup, native platforms, and fallback options.

DeeplinkX 1.5.8 · Source

Platforms and setup

Native platforms: ios, android.

Public actions

GoogleMaps.open

factory GoogleMaps.open({final bool fallbackToStore = false})

Launch with DeeplinkX.launchApp. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
fallbackToStoreboolNofalse

Exact source

GoogleMaps.view

static GoogleMapsViewAction view({ required final Coordinate coordinate, final double? zoom, final bool fallbackToStore = false, })

Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
coordinateCoordinateYes—
zoomdouble?No—
fallbackToStoreboolNofalse

Exact source

static GoogleMapsSearchAction search({ required final String query, final bool fallbackToStore = false, })

Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
queryStringYes—
fallbackToStoreboolNofalse

Exact source

GoogleMaps.directions

static GoogleMapsDirectionsAction directions({ required final String destination, final String? origin, final GoogleMapsTravelMode? mode, final bool fallbackToStore = false, })

Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
destinationStringYes—
originString?No—
modeGoogleMapsTravelMode?No—
fallbackToStoreboolNofalse

Exact source

GoogleMaps.directionsWithCoords

static GoogleMapsDirectionsWithCoordsAction directionsWithCoords({ required final Coordinate destination, final Coordinate? origin, final GoogleMapsTravelMode? mode, final bool fallbackToStore = false, })

Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
destinationCoordinateYes—
originCoordinate?No—
modeGoogleMapsTravelMode?No—
fallbackToStoreboolNofalse

Exact source

Provider setup and examples

DeeplinkX provides support for Google Maps deep linking actions on iOS and Android.

References

Available Actions

Launch Google Maps App

final deeplinkX = DeeplinkX();
await deeplinkX.launchApp(GoogleMaps.open());

View Map Action

await deeplinkX.launchAction(
  GoogleMaps.view(
    coordinate: const Coordinate(latitude: 37.4220, longitude: -122.0841),
    zoom: 14,
  ),
);

Search Location Action

await deeplinkX.launchAction(
  GoogleMaps.search(query: 'Central Park, New York'),
);

Directions Action

await deeplinkX.launchAction(
  GoogleMaps.directions(
    origin: 'Times Square, New York',
    destination: 'Statue of Liberty',
    mode: GoogleMapsTravelMode.transit,
  ),
);

Directions with Coordinates Action

await deeplinkX.launchAction(
  GoogleMaps.directionsWithCoords(
    origin: const Coordinate(latitude: 40.7580, longitude: -73.9855),
    destination: const Coordinate(latitude: 40.6892, longitude: -74.0445),
    mode: GoogleMapsTravelMode.walking,
  ),
);

Platform Configuration

iOS

Add the following to your ios/Runner/Info.plist inside the LSApplicationQueriesSchemes array:

<string>comgooglemaps</string>

Android

Add the following to your android/app/src/main/AndroidManifest.xml inside the <queries> tag:

<package android:name="com.google.android.apps.maps" />

URL Schemes

  • View map: comgooglemaps://?center={lat},{lng}&zoom={zoom}
  • Search: comgooglemaps://?q={query}
  • Directions: comgooglemaps://?saddr={origin}&daddr={destination}&directionsmode={mode}
  • Directions with coordinates: comgooglemaps://?saddr={origin_lat},{origin_lng}&daddr={dest_lat},{dest_lng}&directionsmode={mode}

Android Intent URIs

  • View map: geo:{lat},{lng}?z={zoom}
  • Search: geo:0,0?q={query}
  • Directions: https://www.google.com/maps/dir/?api=1&destination={destination}&origin={origin}&travelmode={mode}
  • Directions with coordinates: https://www.google.com/maps/dir/?api=1&destination={dest_lat},{dest_lng}&origin={origin_lat},{origin_lng}&travelmode={mode}

Web Fallback URLs

  • View map: https://www.google.com/maps/@?api=1&map_action=map&center={lat},{lng}&zoom={zoom}
  • Search: https://www.google.com/maps/search/?api=1&query={query}
  • Directions: https://www.google.com/maps/dir/?api=1&destination={destination}&origin={origin}&travelmode={mode}
  • Directions with coordinates: https://www.google.com/maps/dir/?api=1&destination={dest_lat},{dest_lng}&origin={origin_lat},{origin_lng}&travelmode={mode}
  • Directions from current location: https://www.google.com/maps/dir/?api=1&destination=40.6892,-74.0445

Google requires api=1 on Maps URLs. Without it, the documented action parameters can be ignored. Coordinate destinations use latitude,longitude order; when origin is omitted, Google Maps starts from the user's current location.

Supported Fallback Stores

When the Google Maps app is not installed, DeeplinkX can redirect users to download Google Maps from:

  • iOS App Store
  • Google Play Store

Enable fallback with the fallbackToStore parameter when launching actions or apps.

Fallback Behavior

  1. Attempt to launch the Google Maps app if installed.
  2. If not installed and fallbackToStore is true, redirect to the appropriate app store.
  3. If the store cannot be opened, fall back to opening the Google Maps website.
  4. Disable all fallbacks by setting disableFallback: true.

Fallback Support for Actions

ActionStore FallbackWeb Fallback
Open app✔️✔️
View map✔️✔️
Search✔️✔️
Directions✔️✔️
Directions with coordinates✔️✔️