Click here to Skip to main content
14,668,498 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want take people location who use my program. But I cant access. Because I havent allow for this function.
There is my code. How can I access?
public async void KoordinatBel()
       {
           Geolocator location = new Geolocator();
           try
           {
               location.DesiredAccuracy = PositionAccuracy.High;
               Geoposition pos = await location.GetGeopositionAsync();
               var lat = pos.Coordinate.Latitude;
               var lang = pos.Coordinate.Longitude;
               MessageDialog yeni = new MessageDialog(lang.ToString() + ' ' + lat.ToString());
               yeni.ShowAsync();


           }
           catch (System.UnauthorizedAccessException)
           {

           }
       }

thanks in advance
Posted
Updated 16-Jul-13 2:13am
v3

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

The first use of the Geolocator object to call GetGeopositionAsync or subscribe to PositionChanged events must be made on the UI thread so that the consent prompt can be shown to the user.
Guidelines for devices that access personal data[^]
   
Comments
berkayerdi 16-Jul-13 8:12am
   
Thanks. I add Location to Declarations and my problem is solved ^^.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100