Awesome
Demonstrates how to use maps and the current user location using the com.google.android.gms:play-services:9.8.0
dependency.
Includes two ways of getting the current user location:
- Using
LocationServices.FusedLocationApi.requestLocationUpdates
- Using
googleMap.setOnMyLocationChangeListener
(deprecated)
Usage
To start the app, first you will need a Google Maps API key and place it in google_maps_api.xml
.
After starting the app, choose the desired approach to obtain the user location.
Memory leak
The project also demonstrates a leak using the first approach.
I'm using LeakCanary to detect memory leaks.
LeakCanary detects a memory leak after calling LocationServices.FusedLocationApi.requestLocationUpdates
and destroying the Activity.
To reproduce:
- Start the app
- Choose LocationServices.FusedLocationApi button
- Start Location Updates
- Press back twice to exit the app
- Wait for LeakCanary to show the leak
See the LeakCanary log.
Bug reports: