UWP turn off kiosk mode

1.6k views Asked by At

I have an UWP application published to the Windows Store and this app can be start into kiosk mode (assigned access). It's works great, but I try to create an button on the app to turn off the kiosk mode and to return to the windows loggin screen. I tried the code given in the doc (https://msdn.microsoft.com/library/windows/hardware/mt633799%28v=vs.85%29.aspx) :

LockApplicationHost lockHost = LockApplicationHost.GetForCurrentView();
if (lockHost != null)
{
    lockHost.RequestUnlock();
}

But I clicked to the button, the app just close and reopen. But don't exit the kiosk mode... I have an excpetion throw in the store, but it's empty. store exception

Can someone help me to understand the problem ?

EDIT

This is the exception :

System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
    at Windows.ApplicationModel.LockScreen.LockApplicationHost.GetForCurrentView()
    at Kiwi.Views.Shell.CloseButton_Tapped(Object sender, RoutedEventArgs e)
1

There are 1 answers

0
Johann67 On BEST ANSWER

Finally I found the problem, I simply add this two Extension in the manifest :

<uap:Extension Category="windows.lockScreenCall" />
<uap:Extension Category="windows.aboveLockScreen" />

And now it's works great!