3
votes

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
I can't reproduce your issue in my side. I think you can try with a new blank project with only one button to test it again. As the doc said: "If the kiosk app ends unexpectedly, the assigned access framework tries to relaunch it. ", you can try with Unlocking event and exit the app like in the example. - Jay Zuo
I have try with a blank project and the issue is the same. But the problem appears only at x64 plateform, but not for x86 ! I think it's maybe a communication problem with Int32 and Int64 when the app try to send a signal to windows... - Johann67
That's weird. I also tested with x64 plateform and it works well. Have you tested with any other device? Do they have the same problem? Besides, the settings here might also helpful. - Jay Zuo
I have try on 5 differents devices (4 in x64 and one in x86) and it's only works on x86. Do you compile for specific plateform ? I call method in the "Tapped" event for button, that's right ? - Johann67
I have found the solution, I will post the answer. Thanks a lot for your help! - Johann67

1 Answers

2
votes

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!