
During each step, add code to the base module. Use the base module as the starting point. You're set up and ready to request location in the app. If you get a prompt saying Reload for language changes to take effect? or something similar, select Yes. This will allow Android Studio to pull in all the necessary components. Wait until Android Studio has finished indexing and building the project before making code changes. During this time, you see the following message in the status bar at the bottom of Android Studio: Please note that Android Studio might take several seconds to compile the project in the background for the first time. There are two folders ( base and complete). (If you are in the Project view, you need to expand the project to see the same thing.) In the upper-left corner of the project window, you should see something like the image below if you are in the Android view. (You won't be pushing any changes back to the Git repo.) Open Android Studio, select " Open an existing Android Studio project" from the welcome screen, and open the project directory.Īfter the project has loaded, you may also see an alert that Git isn't tracking all your local changes. If you do not have Git, you can get the project as a zip file:įile_downloadDownload zip Import the project If you have Git installed, you can simply run the following command: git clone įeel free to visit the GitHub page directly. To get you started as quickly as possible, you can build on this starter project. A device/emulator running a developer preview of Android 10 and 11.Android Studio 3.4 or later to run the code.Add support to the app for Android 10 and 11 by adding logic to access location in the foreground location or while in use.Modify an existing app to add support for requesting location access by adding code for subscribing and unsubscribing to location.Handle foreground location permissions (when the user requests that your app access device location while your app is in use).Follow best practices for location in Android.Some familiarity with activities, services, and permissions.At the end of the codelab, you can expect to have an app that follows the current best practices for retrieving location updates.

In this codelab, you learn how to receive location updates and how to support location on any version of Android, particularly Android 10 and 11.

