[XBOX][UWP][WEBVIEW]Keydown event is not getting triggered on UWP app launch XBOX?

Discus and support [XBOX][UWP][WEBVIEW]Keydown event is not getting triggered on UWP app launch XBOX? in XBoX on Windows to solve the problem; I'm developing an UWP app for XBOX using the WebView method on VS2022. I'm using the addEventListener method to listen for all the keyDown events that... Discussion in 'XBoX on Windows' started by Tharun Koti, Aug 24, 2023.

  1. Tharun Koti
    Tharun Koti Guest

    [XBOX][UWP][WEBVIEW]Keydown event is not getting triggered on UWP app launch XBOX?


    I'm developing an UWP app for XBOX using the WebView method on VS2022.

    I'm using the addEventListener method to listen for all the keyDown events that are getting triggered when any button is pressed on the XBOX controller.

    But the keydown events are not getting triggered at all when I launch the app and to access this keyDown events I need to click on the Controller X icon and close the menu bar after doing this the events are triggered properly.

    JS Code Snippet:

    document.addEventListener(

    "keydown",

    ev => {

    if (ev.keyCode === 196) {

    ev.preventDefault(); // I'm using this to prevent the default back functionality of xbox.

    }

    },

    false

    );

    UWP Code Snippet:

    public App()

    {

    this.InitializeComponent();

    this.RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested; // used this method to remove the mouse mode on XBOX.

    this.Suspending += OnSuspending;

    }

    Is there anyway that can be used to trigger the keyDown events when the app is launched.

    :)
     
    Tharun Koti, Aug 24, 2023
    #1
  2. Mae Sev. Win User

    [XBOX][UWP][WEBVIEW]Keydown event is not getting triggered on UWP app launch XBOX?

  3. Mae Sev. Win User

    [XBOX][UWP][WEBVIEW]Keydown event is not getting triggered on UWP app launch XBOX?

    Hello Tharun Koti,



    We haven't heard from you in 72 hours, so we will consider your issue resolved. If you do need further help, please create a new thread to discuss your concerns through this link: Create a new question or start a new discussion (microsoft.com), as we will not be monitoring this thread going forward.




    [​IMG]




    Thank you for understanding.



    Respectfully,



    Microsoft Moderator
  4. Tharun Koti Win User

    [XBOX][UWP][WEBVIEW]Keydown event is not getting triggered on UWP app launch XBOX?

    After making some research and going through all the Microsoft docs for the XBOX development I found one of the Stack Overflow question which mentioned the same issue but in a different scenario and used that method to get a fix for this in this SO link Why does XAML WebView Input Box not have cursor until I open/close Guide on XBox One? and the comment that has been mentioned in this post Navigation using Controller doesn't work after turning on the controller

    There the same issue has been observed on the input box whereas in our scenario it is with the addEventListener.

    The main root cause which is causing this issue is that the focus is not being set to the WebView when the app is launched. Once I open the XBOX menu guide and close, it is setting the focus on to the WebView which is then able to listen to the events.

    To set the focus on to the WebView we need to add some part of the code explicitly in your code-behind which will help in setting the focus when the app is launched.

    private void MyWebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
    {
    MyWebView.Visibility = Visibility.Collapsed;
    MyWebView.Visibility = Visibility.Visible;
    MyWebView.Focus(FocusState.Keyboard); //here I'm using the keyboard method which worked for me we can go with programmatic method as well.
    }
    Here in the code-behind file we're using the NavigationCompleted which will be called once the WebView is successfully loaded the required content and then we're making the Visibility to collapsed and visible again which will help in setting the focus on to the WebView and listen to the keyDown Events.

    Hope this helps and Happy Coding!!!
  5. Mae Sev. Win User

    [XBOX][UWP][WEBVIEW]Keydown event is not getting triggered on UWP app launch XBOX?

    Hello Tharun Koti,

    Welcome to Xbox Forums. We appreciate you for sharing your concern with us.

    Based on your description, you are having issues with UWP app launch box from your end. Developers have several options for achieving automated launching of Universal Windows Platform (UWP) apps. In regards with this issue we have, I will point you to the right direction and provide you helpful links that you can check and verify. See the info below:

    Getting started with UWP app development on Xbox One - UWP applications | Microsoft Learn

    Known issues with UWP on Xbox Developer Program - UWP applications | Microsoft Learn

    Automate launching Windows 10 Universal Windows Platform (UWP) apps - UWP applications | Microsoft Learn

    UWP on Xbox One - UWP applications | Microsoft Learn

    If you need further help, kindly check this link Microsoft supported products on Q&A | Microsoft Learn. There, you can ask an IT developer expert in relation with the issue we have.

    I hope that it helps.

    Kind regards,



    Microsoft Community Moderator
  6. XBF Meryem R Win User

    Visual Studio hangs when trying to run C++ UWP project on Xbox One

Thema:

[XBOX][UWP][WEBVIEW]Keydown event is not getting triggered on UWP app launch XBOX?

Loading...
  1. [XBOX][UWP][WEBVIEW]Keydown event is not getting triggered on UWP app launch XBOX? - Similar Threads - UWP WEBVIEW Keydown

  2. When the uwp application published on xbox performs auth2.0 login authorization, a blank...

    in XBoX Accessibility
    When the uwp application published on xbox performs auth2.0 login authorization, a blank...: A year ago, we released a uwp application called "NARAKA+" on the xbox platform. At that time, we used oath2.0 to log in and authorize through...
  3. unable to deploy UWP from Visual Studio to Xbox Series S

    in XBoX on Windows
    unable to deploy UWP from Visual Studio to Xbox Series S: I'm trying to deploy a UWP package to my Xbox Series S: PC developer mode enabled; new VS 2022 UWP C# project; configuration target x64; target version 'Windows 10, version 2004'; Xbox...
  4. How do I stop UWP from stoping my game from running in the background when I change tabs

    in XBoX Games and Apps
    How do I stop UWP from stoping my game from running in the background when I change tabs: Every time I change tabs it suspends the game I’m trying to play 17a2fb5a-e0cd-4d04-a9df-314e66e1b4e6
  5. Microsoft Visual C++ 2015 UWP Desktop Runtime Package Infinite Install Prompt

    in XBoX Games and Apps
    Microsoft Visual C++ 2015 UWP Desktop Runtime Package Infinite Install Prompt: When trying to install any game form game pass i get stuck in infinite loop installing Microsoft Visual C++ 2015 UWP Desktop Runtime Package and stop downloading a game and it look like this......
  6. Why the blur effect is not working on the UWP WebView app on XBOX?

    in XBoX on Windows
    Why the blur effect is not working on the UWP WebView app on XBOX?: Currently, I'm trying to use my web source URL to develop an UWP webview app on VS2022. In my web source URL we're using the different stylings for dir='rtl' for arabic language so when I run the...
  7. Focus issue when relaunching the UWP app from installed apps.

    in XBoX on Windows
    Focus issue when relaunching the UWP app from installed apps.: Hi I'm trying to develop an UWP app for XBOX using the Webview. But I'm currently facing an issue when i relaunch the application from the Games and Apps tab. Issue: When I launch the app from...
  8. UWP keeps 'suspending' my Minecraft game while I'm actively playing it!!???

    in XBoX Games and Apps
    UWP keeps 'suspending' my Minecraft game while I'm actively playing it!!???: When playing Minecraft (Minecraft for Windows) the game keeps stalling (stopping, like it's paused)...and when I go to Task Manager to find out why, I see the yellow 'pause' icon, and it says that...
  9. Can anyone on Windows 11 who uses game bar help me unsuspend the game bar from UWP task thing?

    in XBoX on Windows
    Can anyone on Windows 11 who uses game bar help me unsuspend the game bar from UWP task thing?: The UWP is suspending my game bar and will not let me access it at all and I've tried to look up solutions for none to work. 9f138b95-88e5-4902-90c3-cc71042860e8
  10. How to integrate Directx12 HelloWorld Sample with UWP application C++/WinRT blank app?

    in XBoX Games and Apps
    How to integrate Directx12 HelloWorld Sample with UWP application C++/WinRT blank app?: I am trying to use DirectX12 along with XAML together in my Universal Windows Platform (UWP) app. I found this link for directX11 and XAML interop but couldn't find anything as simple as this for...