Requesting location change notifications
The LocationManager
class provides a series of overloaded methods that can be used to request location update notifications. If you simply need a single update, you can call RequestSingleUpdate()
; to receive ongoing updates, call RequestLocationUpdate()
.
Prior to requesting location updates, you must identify the location provider that should be used. In our case, we simply want to use the most accurate provider available at the time. This can be accomplished by specifying the criteria for the desired provider using an instance of Android.Location.Criteria
. The following code example shows how to specify the minimum criteria:
Criteria criteria = new Criteria(); criteria.Accuracy = Accuracy.NoRequirement; criteria.PowerRequirement = Power.NoRequirement;
Now that we have the criteria, we are ready to request updates as follows:
locMgr.RequestSingleUpdate (criteria, this, null);
Implementing ILocationListener
You will notice that the second parameter to RequestSingleUpdate...