Send feedback
Places SDK for Android code samples
Stay organized with collections
Save and categorize content based on your preferences.
The Places SDK for Android samples repository on
GitHub
includes sample apps that demonstrate the use of the Places SDK for Android.
Import and build the app, add your API key, view the demo, and use the sample code supplied as a
starting point for your app.
When you run the sample app, it displays a list of available samples that you can
run on your own device. Select one of the options. For example, click
Place Autocomplete .
Troubleshooting: If the sample app runs successfully but you
don't see a map, check that you've added your API key to the app's manifest file, as described in
Using API Keys .
Clone and run the samples
Git is required to run this sample locally. The following command clones the sample
application repository.
git clone git@github.com:googlemaps-samples/android-places-demos.git
Import the sample project into Android Studio:
In Android Studio, select File > New > Import Project .
Go to the location where you saved the repository and select the project directory for
Kotlin or Java:
Kotlin : PATH-REPO /android-places-demos/demo-kotlin
Java : PATH-REPO /android-places-demos/demo-java
Select Open . Android Studio builds your project, using the Gradle build
tool.
In your top-level project directory, create a secrets.properties
file.
In the secrets.properties
file, add the following strings, replacing YOUR_API_KEY with the value of
your API key:
PLACES_API_KEY=YOUR_API_KEY
MAPS_API_KEY=YOUR_API_KEY
Run the app.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-04 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{"lastModified": "Last updated 2024-10-04 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-04 UTC."]]