Open dpaquette opened 6 years ago
I got this working on the plane. I will try to get it checked in and published soon
This is done. I just need to update the Readme with a sample so people know how to use it
Hello! Im trying to get the WatchLocation feature to work, but it seems like it never fires, my breakpoint in OnWatchLocationCallback is never hit. Have I missed something obvious? GetLocationAsync works like a charm :)
@functions
{
private string _position = string.Empty;
Location _location;
protected override async Task OnInitAsync()
{
await LocationService.WatchLocation(OnWatchLocationCallback);
_location = await LocationService.GetLocationAsync();
}
private void OnWatchLocationCallback(Location obj)
{
_position = $"{obj.Latitude} - {obj.Longitude} - {obj.Accuracy}";
}
}
Hello! Im trying to get the WatchLocation feature to work, but it seems like it never fires, my breakpoint in OnWatchLocationCallback is never hit. Have I missed something obvious? GetLocationAsync works like a charm :)
@functions { private string _position = string.Empty; Location _location; protected override async Task OnInitAsync() { await LocationService.WatchLocation(OnWatchLocationCallback); _location = await LocationService.GetLocationAsync(); } private void OnWatchLocationCallback(Location obj) { _position = $"{obj.Latitude} - {obj.Longitude} - {obj.Accuracy}"; } }
Hello,
Did you end up figuring this out? I tried it also and it only seemed to work when i call the WatchLocation method from OnAfterRenderAsync
override.
Example:
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await LocationService.WatchLocation(OnWatchLocationCallback);
StateHasChanged();
}
The
watchPosition
method seems useful. We should support it. https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition