Access to location in windows 10 (universal app)

Asked

Viewed 226 times

2

I was trying to convert an old project of mine made for Windows phone 8.1 to a universal application for Windows 10, when I came across this error below.

The question is, how do I fix it? , how do I ask for access to the location of an actual computer? like I know there ... using alocalizaliz via ip in the absence of a gps

An Exception of type 'System.Unauthorizedaccessexception' occurred in mscorlib.ni.dll but was not handled in user code

Winrt information: Your Application is not allowed to access location data. Make sure ID_CAP_LOCATION is set in the application manifest on your phone, if you enabled the location by selecting Settings > Location.

Additional information: Access denied.

Your App is not allowed to access location data. Make sure ID_CAP_LOCATION is set in the application manifest on your phone, if you enabled the location by selecting Settings > Location.

If there is a Handler for this Exception, the program may be Safely continued.

`

  • What version of Windows and Visual Studio?

  • visual studio 2015 and Windows 10

1 answer

0


To provide location access in Windows 10 you need to add Devicecapability Location in the Package.appxmanifest

 <Capabilities>
   <Capability Name="internetClient" />
   <DeviceCapability Name="location" />
 </Capabilities>

Obs.: There is a script that can help migrate 8.1 apps to Universal Windows Platform. It is available in https://github.com/Win10DevGuideMVA/ProjectUpgradeUtility

Browser other questions tagged

You are not signed in. Login or sign up in order to post.