LocationManager.GetLastKnownLocation(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the last known ___location from the given provider, or null if there is no last known ___location.
[Android.Runtime.Register("getLastKnownLocation", "(Ljava/lang/String;)Landroid/___location/Location;", "GetGetLastKnownLocation_Ljava_lang_String_Handler")]
public virtual Android.Locations.Location? GetLastKnownLocation(string provider);
[<Android.Runtime.Register("getLastKnownLocation", "(Ljava/lang/String;)Landroid/___location/Location;", "GetGetLastKnownLocation_Ljava_lang_String_Handler")>]
abstract member GetLastKnownLocation : string -> Android.Locations.Location
override this.GetLastKnownLocation : string -> Android.Locations.Location
Parameters
- provider
- String
a provider listed by #getAllProviders()
Returns
the last known ___location for the given provider, or null if not available
- Attributes
Exceptions
if no suitable permission is present
if provider is null or doesn't exist
Remarks
Gets the last known ___location from the given provider, or null if there is no last known ___location. The returned ___location may be quite old in some circumstances, so the age of the ___location should always be checked.
This will never activate sensors to compute a new ___location, and will only ever return a cached ___location.
See also #getCurrentLocation(String, CancellationSignal, Executor, Consumer)
which will always attempt to return a current ___location, but will potentially use additional power in the course of the attempt as compared to this method.
Java documentation for android.___location.LocationManager.getLastKnownLocation(java.lang.String)
.
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.