A special location provider for receiving locations without actually initiating a location fix.
This provider can be used to passively receive location updates when other applications or services request them without actually requesting the locations yourself. This provider will return locations generated by other providers. You can query the getProvider() method to determine the origin of the location update. Requires the permission ACCESS_FINE_LOCATION, although if the GPS is not enabled this provider might only return coarse fixes.
1. Ensure to change the minSDKVersion to 8, or greater.
2. Set Permission to Allow Location Information
3. Declare a String Variable named myPassiveProvider.
4. Add the LocationManager class to the imports section.
5. Add the below line to the onCreate method. This will save the Passive Provider to the string variable myPassiveProvider.
myPassiveProvider = LocationManager.PASSIVE_PROVIDER;
6. Compile and run!
Professional Android 4 Application Development by Reto Meier, pg 525