Android.Locations.LocationManager.SetTestProviderLocation Method
Sets a mock location for the given provider.

Syntax

[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, Location loc)

Parameters

provider
the provider name
loc
the mock location

Exceptions

TypeReason
Java.Lang.SecurityExceptionif the ACCESS_MOCK_LOCATION permission is not present or the NoType:android/provider/Settings$Secure;Href=../../../reference/android/provider/Settings.Secure.html#ALLOW_MOCK_LOCATION} system setting is not enabled
Java.Lang.IllegalArgumentExceptionif no provider with the given name exists
Java.Lang.IllegalArgumentExceptionif the location is incomplete

Remarks

Sets a mock location for the given provider.

This location will be used in place of any actual location from the provider. The location object must have a minimum number of fields set to be considered a valid LocationProvider Location, as per documentation on Android.Locations.Location class.

[Android Documentation]

Requirements

Namespace: Android.Locations
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 3