Register for location updates using the named provider, and a pending intent.
Parameters:
provider - the name of the provider with which to register
minTime - minimum time interval between location updates, in milliseconds
minDistance - minimum distance between location updates, in meters
listener - a LocationListener whose onLocationChanged(Location) method will be called for each location update
Throws
IllegalArgumentException - if provider is null or doesn't exist on this device
IllegalArgumentException - if listener is null
RuntimeException - if the calling thread has no Looper
SecurityException - if no suitable permission is present
** A passive provider receives location updates if, and only if, another application requests them, letting your application passively receive location updates without activating any Location Provider.
1. Get a Reference to LocationManager named myLocationManager.
4. Add the below line to the onCreate method. This will request the Passive Provider named myPassiveProvider to request location updates every 0 milliseconds, and 0 meters and use the LocationListener named myLocationListener for the results.
myLocationManager.requestLocationUpdates(myPassiveProvider, 0, 0, myLocationListener);
5. Compile and run!
Resources:
Professional Android 4 Application Development by Reto Meier, pg 525
http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener)