Warning This sample has been deprecated and is no longer being maintained.
Find the new location samples in the new platform-samples repo.
The location and context APIs harness the sensors and signals of mobile devices to provide awareness of user actions and their environment, enabling delightful and engaging experiences that simplify user interactions, provide assistance, and help users to better understand themselves.
This repo contains the following samples:
-
Activity Recognition (Kotlin) - Demonstrates the ActivityRecognitionApi to determine the user's current activity.
-
AwarenessApisSampleKotlin (Kotlin) - Demonstrates use of the Awareness APIs to intelligently react to the current situation of the user.
-
ForegroundLocationUpdates (Kotlin) - Get updates about a device's location using a bound foreground service.
-
Geofencing (Java) - Create geofences and process enter and exit transitions.
-
LocationAddress (Kotlin) - Use the Geocode API to display a device's location as an address.
-
LocationUpdatesBackgroundKotlin (Kotlin) - Demonstrates the correct way to retrieve location updates in the background.
-
SleepSampleKotlin (Kotlin) - Demonstrates use of the Sleep API to recognize a user's sleep activity.
- Android API Level >v9
- Android Build Tools >v21
- Google Support Repository
These samples use the Gradle build system. To build a sample, use the "gradlew build" command or use "Import Project" in Android Studio.
- Stack Overflow: http://stackoverflow.com/questions/tagged/google-play-services
If you've found an error in these samples, please file an issue: https://github.com/android/location-samples/issues
Patches are encouraged, and may be submitted according to the instructions in CONTRIBUTING.md.
These samples are distributed under the terms of the Apache License (Version 2.0). See the license for more information.