Metro Control Panel-> PC Settings ->Privacy- >Let apps use my location. How do I know whether this is "turned on' or "turned off' Programatically. I tried below. But irrespective of whether I turn on or off I am getting AsyncStatus::Error and Positionstatus
as Disabled. Is this the right API?
Windows::Devices::Geolocation::Geolocator^ locator= ref new Windows::Devices::Geolocation::Geolocator ();
Windows::Devices::Geolocation::PositionStatus status= locator->LocationStatus ;
Windows::Foundation::IAsyncOperation<Windows::Devices::Geolocation::Geoposition^ > ^ operation= locator->GetGeopositionAsync( );
operation->Completed= ref new Windows::Foundation::AsyncOperationCompletedHandler<Windows::Devices::Geolocation::Geoposition^>( [locator] (IAsyncOperation<Windows::Devices::Geolocation::Geoposition^>^ operation,
Windows::Foundation::AsyncStatus status )
{
switch( status)
{
case Windows::Foundation::AsyncStatus::Completed:
{
Windows::Devices::Geolocation::PositionStatus status= locator->LocationStatus ;
}
break;
case Windows::Foundation::AsyncStatus::Error:
{
Windows::Devices::Geolocation::PositionStatus status= locator->LocationStatus ;
break;
}
}
});