Share via


LocationManager.GetBestProvider(Criteria, Boolean) Method

Definition

Returns the name of the provider that best meets the given criteria.

[Android.Runtime.Register("getBestProvider", "(Landroid/location/Criteria;Z)Ljava/lang/String;", "GetGetBestProvider_Landroid_location_Criteria_ZHandler")]
public virtual string? GetBestProvider (Android.Locations.Criteria criteria, bool enabledOnly);
[<Android.Runtime.Register("getBestProvider", "(Landroid/location/Criteria;Z)Ljava/lang/String;", "GetGetBestProvider_Landroid_location_Criteria_ZHandler")>]
abstract member GetBestProvider : Android.Locations.Criteria * bool -> string
override this.GetBestProvider : Android.Locations.Criteria * bool -> string

Parameters

criteria
Criteria

the criteria that need to be matched

enabledOnly
Boolean

if true then only enabled providers are included

Returns

name of the provider that best matches the criteria, or null if none match

Attributes

Remarks

Returns the name of the provider that best meets the given criteria. Only providers that are permitted to be accessed by the caller will be returned. If several providers meet the criteria, the one with the best accuracy is returned. If no provider meets the criteria, the criteria are loosened in the following order:

<ul> <li> power requirement <li> accuracy <li> bearing <li> speed <li> altitude </ul>

Note that the requirement on monetary cost is not removed in this process.

This member is deprecated. Criteria based APIs are deprecated, prefer to select a provider explicitly.

Java documentation for android.location.LocationManager.getBestProvider(android.location.Criteria, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to