Xamarin Labs GeoLocation - LocationManager.PassiveProvider Android

Hello,

I'm using the geoLocation Plugin from labs.

For android we have the part of the code where we find the providers:

public Geolocator()
        {
            _manager = (LocationManager)Application.Context.GetSystemService(Context.LocationService);
            _providers = _manager.GetProviders(false).Where(s => s != LocationManager.PassiveProvider).ToArray();
        }

I'm having some problems in my app... where I found that sometimes it do not get the location as it should. While other apps was returning the location normally.

Before using Labs I was using a custom code where I used to use:

Criteria locationCriteria = new Criteria
            {   
                Accuracy  = Accuracy.Fine ,
                PowerRequirement = Power.Medium,
            }; 
_locationProvider = _locationManager.GetBestProvider (locationCriteria, false);

And it was working fine.

I suspected about the LocationManager.PassiveProvider and looked for some answers.... and found this

If the service requests a passive location provider a location is send every time Google maps is started and a fix aquired or some other apps initiates a location provider update and the service can act on location data without spending additional power on the location updates.

If you need correct location data at an exact moment using this provider won't help.

My question is... The passive provider do not, really, get the location? just use the location already "cached" from other apps?

I should use just _providers = _manager.GetProviders(true).ToArray(); if want more specific location?

Thanks

Answers

Sign In or Register to comment.