Android
Google Maps Integration
Mobile Development
Intent API
App Navigation

How to open standard Google Map application from my application?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

On Android, the standard way to open Google Maps from your app is an Intent with a maps URI. That lets you hand off search, navigation, or coordinate display to the installed Maps application instead of embedding your own map screen. The important parts are building the correct URI, restricting the intent to Google Maps only when you mean to, and adding a fallback when the app is not installed.

Open Google Maps with a Search Query

If you want to search for a place name or address, use a geo: URI with the query in q.

kotlin
1import android.content.Intent
2import android.net.Uri
3
4val gmmIntentUri = Uri.parse("geo:0,0?q=1600+Amphitheatre+Parkway,+Mountain+View")
5val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
6mapIntent.setPackage("com.google.android.apps.maps")
7
8startActivity(mapIntent)

setPackage("com.google.android.apps.maps") ensures the intent goes to Google Maps if it is installed. Without that line, Android may offer several map-capable apps.

Open a Specific Latitude and Longitude

If you already have coordinates, put them directly in the URI:

kotlin
1import android.content.Intent
2import android.net.Uri
3
4val lat = 43.6532
5val lng = -79.3832
6
7val uri = Uri.parse("geo:$lat,$lng?q=$lat,$lng(Toronto)")
8val intent = Intent(Intent.ACTION_VIEW, uri)
9intent.setPackage("com.google.android.apps.maps")
10
11startActivity(intent)

The label in parentheses is optional, but it helps the destination look clearer to the user.

Launch Turn-by-Turn Navigation

If the user should go straight into navigation mode, use the google.navigation: scheme:

kotlin
1import android.content.Intent
2import android.net.Uri
3
4val navUri = Uri.parse("google.navigation:q=43.6532,-79.3832")
5val navIntent = Intent(Intent.ACTION_VIEW, navUri)
6navIntent.setPackage("com.google.android.apps.maps")
7
8startActivity(navIntent)

This is better than a plain geo: search when the user action is clearly "start navigation now."

Add a Safe Fallback

Never assume Google Maps is installed. Check whether the intent can resolve, and fall back to a browser URL if needed.

kotlin
1import android.content.Intent
2import android.net.Uri
3
4fun openMap(query: String) {
5    val appUri = Uri.parse("geo:0,0?q=${Uri.encode(query)}")
6    val appIntent = Intent(Intent.ACTION_VIEW, appUri).apply {
7        setPackage("com.google.android.apps.maps")
8    }
9
10    if (appIntent.resolveActivity(packageManager) != null) {
11        startActivity(appIntent)
12        return
13    }
14
15    val webUri = Uri.parse("https://www.google.com/maps/search/?api=1&query=${Uri.encode(query)}")
16    startActivity(Intent(Intent.ACTION_VIEW, webUri))
17}

That fallback keeps the feature working on devices without the Maps app.

Use the Right Intent Shape for the User Action

Different map actions should use different URI formats. Search queries are good for addresses and place names, while coordinate-based URIs are better when you already have precise latitude and longitude. Navigation URIs should be used only when the app intends to send the user directly into route guidance.

If you blur those cases together, users often land in a search screen when they expected turn-by-turn directions, or they lose a precise coordinate because the query was formatted as loose text. Being explicit about the action makes the handoff feel native instead of improvised.

Do Not Confuse This with the Maps SDK

If the goal is to launch the external app, you do not need the Google Maps SDK, an API key, or an embedded map fragment. Those are needed only when your app displays maps inside its own UI.

This distinction matters because many implementations become more complex than necessary. Launching the installed Maps app should stay a lightweight intent handoff.

Common Pitfalls

  • Building the intent with a raw query string and forgetting to URI-encode spaces and punctuation.
  • Using setPackage without checking whether Google Maps is actually installed.
  • Reaching for the Maps SDK when the requirement is only to open the external Maps app.
  • Using a search URI when the real user action should start navigation directly.
  • Assuming every Android device has Google services and Google Maps available.

Summary

  • Use an Android Intent with geo: or google.navigation: URIs to open Google Maps.
  • Restrict to the Google Maps package only when that exact app is required.
  • Encode query text before building the URI.
  • Add a browser fallback so the feature still works when Maps is missing.
  • Use the Maps SDK only if you need an embedded map inside your own app.

Course illustration
Course illustration

All Rights Reserved.