none
[xbox live][fall creators SDK][xbox one]Pressing the "B" red button suspends game and goes back to dashboard RRS feed

  • Question

  •      Hi Everybody!!!

         I have a problem, and I was wondering if someone could share some light about it. In short, I have compiled my game with Visual Studio 2017 targeting Windows Fall Creators SDK. I have deployed it to my Xbox One S. When I press the "B" button, my game is suspended and the Xbox One Dashboard gets focus. Now, this didn't happen before I upgraded it.

         I read in this forum that this issue happened in the past, but it was fixed by a hot fix.

         Any help is greatly appreciated!!!

         Manuel


    Tarh ik

    Sunday, November 26, 2017 3:38 AM

Answers

  • Pressing the B button on a game controller sends the "BackRequest" message to the application which was implemented in the Creators Update (March 2017). If your application does not handle the back-request, then it will end up suspending your app (i.e. the user 'backed' out of your app)

    This works fine for XAML apps with a natural 'page stack', but is not desirable for Direct3D apps. The solution is to handle the navigation message in your app.

    If using C++/CX (i.e. /ZW) Language Extensions:

    virtual void SetWindow(CoreWindow^ window)
    {
    ...
    auto navigation = Windows::UI::Core::SystemNavigationManager::GetForCurrentView();
    navigation->BackRequested +=
    ref new EventHandler<BackRequestedEventArgs^>(this, &ViewProvider::OnBackRequested);
    }
    
    void OnBackRequested(Platform::Object^, Windows::UI::Core::BackRequestedEventArgs^ args)
    {
    // UWP on Xbox One triggers a back request whenever the B
    // button is pressed which can result in the app being
    // suspended if unhandled
    args->Handled = true;
    }
    

    If you are using C++/WinRT projections:

    void SetWindow(CoreWindow const & window)
    {
    …
    auto navigation = SystemNavigationManager::GetForCurrentView();
    // UWP on Xbox One triggers a back request whenever the B
    // button is pressed which can result in the app being
    // suspended if unhandled
    navigation.BackRequested([](const winrt::Windows::Foundation::IInspectable&, const BackRequestedEventArgs& args)
    {
    args.Handled(true);
    });
    }
    

    • Marked as answer by Tarh ik Thursday, November 30, 2017 5:24 AM
    Monday, November 27, 2017 6:43 PM

All replies

  • Pressing the B button on a game controller sends the "BackRequest" message to the application which was implemented in the Creators Update (March 2017). If your application does not handle the back-request, then it will end up suspending your app (i.e. the user 'backed' out of your app)

    This works fine for XAML apps with a natural 'page stack', but is not desirable for Direct3D apps. The solution is to handle the navigation message in your app.

    If using C++/CX (i.e. /ZW) Language Extensions:

    virtual void SetWindow(CoreWindow^ window)
    {
    ...
    auto navigation = Windows::UI::Core::SystemNavigationManager::GetForCurrentView();
    navigation->BackRequested +=
    ref new EventHandler<BackRequestedEventArgs^>(this, &ViewProvider::OnBackRequested);
    }
    
    void OnBackRequested(Platform::Object^, Windows::UI::Core::BackRequestedEventArgs^ args)
    {
    // UWP on Xbox One triggers a back request whenever the B
    // button is pressed which can result in the app being
    // suspended if unhandled
    args->Handled = true;
    }
    

    If you are using C++/WinRT projections:

    void SetWindow(CoreWindow const & window)
    {
    …
    auto navigation = SystemNavigationManager::GetForCurrentView();
    // UWP on Xbox One triggers a back request whenever the B
    // button is pressed which can result in the app being
    // suspended if unhandled
    navigation.BackRequested([](const winrt::Windows::Foundation::IInspectable&, const BackRequestedEventArgs& args)
    {
    args.Handled(true);
    });
    }
    

    • Marked as answer by Tarh ik Thursday, November 30, 2017 5:24 AM
    Monday, November 27, 2017 6:43 PM
  •       Hi Chuck!!!!

          Nice, THANKS!!! That makes sense. I'll implement it this late evening - I'll keep you posted.

          Thanks again!!!

          Best Regards,

          Manuel


    Tarh ik

    Monday, November 27, 2017 7:46 PM
  •      Thanks Chuck!!!!

         Your code did the trick!!!! Indeed, once the event handler was added, the "B" button no longer suspends the game.

         Best Regards,

         Manuel


    Tarh ik

    Thursday, November 30, 2017 5:25 AM