GetGeopositionAsync does not return

后端 未结 10 741
北恋
北恋 2021-01-08 00:13

In my Windows Phone 8 app, I am trying to use GetGeopositionAsync on the main page to display some items based on user location.

Calling GetGeopositionAsync does not

10条回答
  •  时光取名叫无心
    2021-01-08 00:40

    This weird behaviour happens when the status of geolocator is in NotInitialized state while calling the GetGeopositionAsync().

    The geolocator is only Ready in two cases. One, when it is subscribed to a PositionChanged event. Two, when a GetGeopositionAsync() is called already.

    So, you just have to subscribe the geolocator to a positionChanged event before calling the GetGeopositionAsync().

    Hope this helps.

提交回复
热议问题