Mvvmcross 位置插件当前和最后一次看到的位置为空

Mvvmcross Location Plugin current and last seen locations are null

我正在尝试使用 mvvmcross 位置插件在我的应用程序中获取位置,但它总是抛出空引用异常,因为 CurrentLocationLastSeenLocation 始终为空。 GPS 服务已在真实 android 设备上启用,权限已在 android 清单中配置。我已经在 genymotion 上测试了应用程序,如果我打开 GPS,它就可以工作。我不明白,为什么位置提供者不在真实设备上提供位置。 这是代码示例:

 private void GetLocation()
    {
        IMvxLocationWatcher _locationWatcher = Mvx.Resolve<IMvxLocationWatcher>();
        _locationWatcher.Start(new MvxLocationOptions() {Accuracy = MvxLocationAccuracy.Fine}, OnLocation, OnError );
        try
        {
            Lat = _locationWatcher.CurrentLocation.Coordinates.Latitude;
            Lng = _locationWatcher.CurrentLocation.Coordinates.Longitude;
        }
        catch
        {
            Lat = _locationWatcher.LastSeenLocation.Coordinates.Longitude;
            Lng = _locationWatcher.LastSeenLocation.Coordinates.Longitude;
        }
    }

需要调用OnLocation回调才能获取位置信息。例如,这是获取位置的一种方法:

private void GetLocation()
{
    IMvxLocationWatcher _locationWatcher = Mvx.Resolve<IMvxLocationWatcher>();
    _locationWatcher.Start(new MvxLocationOptions() {Accuracy = MvxLocationAccuracy.Fine}, (location) => {
        // Use location parameter to get location information}, 
     OnError);
}