IGeolocation.GetLastKnownLocationAsync 方法

定義

傳回裝置的最後一個已知位置。

public:
 System::Threading::Tasks::Task<Microsoft::Maui::Devices::Sensors::Location ^> ^ GetLastKnownLocationAsync();
public System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location?> GetLastKnownLocationAsync ();
abstract member GetLastKnownLocationAsync : unit -> System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location>
Public Function GetLastKnownLocationAsync () As Task(Of Location)

傳回

物件 Location ,包含最近的位置資訊,如果沒有 null 已知位置,則為 。

備註

如有需要,將會在運行時間要求位置許可權。 您可能仍然需要在應用程式指令清單中宣告某個專案。

這個位置可能是最近快取的位置。

適用於