Sdílet prostřednictvím


LocationManager.SetTestProviderLocation(String, Location) Method

Definition

Sets a new location for the given test provider.

[Android.Runtime.Register("setTestProviderLocation", "(Ljava/lang/String;Landroid/location/Location;)V", "GetSetTestProviderLocation_Ljava_lang_String_Landroid_location_Location_Handler")]
public virtual void SetTestProviderLocation (string provider, Android.Locations.Location location);
[<Android.Runtime.Register("setTestProviderLocation", "(Ljava/lang/String;Landroid/location/Location;)V", "GetSetTestProviderLocation_Ljava_lang_String_Landroid_location_Location_Handler")>]
abstract member SetTestProviderLocation : string * Android.Locations.Location -> unit
override this.SetTestProviderLocation : string * Android.Locations.Location -> unit

Parameters

provider
String

the provider name

location
Location

the mock location

Attributes

Exceptions

if OpstrMockLocation is not set to ModeAllowed for your app.

if no provider with the given name exists

if the location is incomplete

Remarks

Sets a new location for the given test provider. This location will be identiable as a mock location to all clients via Location#isMock().

The location object must have a minimum number of fields set to be considered valid, as per documentation on Location class.

Java documentation for android.location.LocationManager.setTestProviderLocation(java.lang.String, android.location.Location).

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