It seems that the first time a project is run that uses QRCodeWatcher.RequestAccessAsync() it will not initialize (await never returns, even after the user has accepted permissions).
This does not occur on subsequent runs as permissions have already been granted.
A workaround is to wait on this function which explicitly will request permission before calling RequestAccessAsync()
{
#if WINDOWS_UWP
try
{
await new Windows.Media.Capture.MediaCapture().InitializeAsync();
Debug.Log("Camera and Microphone permissions OK");
return true;
}
catch (UnauthorizedAccessException)
{
Debug.LogError("Camera and microphone permissions not granted.");
return false;
}
#else
return true;
#endif
}
Following on from over here: https://github.com/microsoft/MixedReality-WorldLockingTools-Samples/issues/20
It seems that the first time a project is run that uses
QRCodeWatcher.RequestAccessAsync()
it will not initialize (await never returns, even after the user has accepted permissions).This does not occur on subsequent runs as permissions have already been granted.
A workaround is to wait on this function which explicitly will request permission before calling
RequestAccessAsync()