Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange behaviour of Geolocator.GetGeopositionAsync() after first launch
    primarykey
    data
    text
    <p>I'm writing Windows Phone 8 app that needs to get location of device (do not track changes, just get location). I added next code to the method OnNavigatedTo() of my start page but after launching app, the progress indicator does not hide even after 10 seconds timeout. But if I navigate to another page and then go back, everything works fine. This happens on the emulator, I don't have a real device. What am I doing wrong?</p> <pre class="lang-cs prettyprint-override"><code>protected async override void OnNavigatedTo(NavigationEventArgs e) { if(_geoPosition == null) { try { var geolocator = new Geolocator(); geolocator.DesiredAccuracyInMeters = 50; _progressIndicator = new ProgressIndicator { IsIndeterminate = true, Text = "Getting current location, please wait...", IsVisible = true }; SystemTray.SetIsVisible(this, true); SystemTray.SetProgressIndicator(this, _progressIndicator); _geoPosition = await geolocator.GetGeopositionAsync(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10)); _progressIndicator.IsVisible = false; SystemTray.SetIsVisible(this, false); } catch (UnauthorizedAccessException) { MessageBox.Show("Location is disabled in phone settings"); } } } </code></pre> <p>Thanks!</p> <p><strong>UPD</strong>: just tried to add this code to empty project and it works fine. Tried to comment out some parts of OnNavigatedTo that I did not include to the snippet and found out that the reason somewhere in initialization of data source for this page. I'm sorry for false alarm.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload