user7029855
user7029855

Reputation: 21

Preventing UWP from shutting down by pressing ‘B’ button on XBOX – XAMARIN

There is a post in stackoverflow that covers my research in this matter so far: How to do job while the application is exiting in UWP?

I found this solution in several searches about the preventing UWP from closing and it works, I know I’ll have to ask for approval before I submit my app to Windows Store to use Restricted capabilities to use it, but it is ok.

But the point is: I’m writing an app to run in Android, iOS and UWP platforms, in UWP the ability of the user to close the app in a PC is quite alright but closing the app in XBOX by accidentally press button B in the Gamepad control is a very annoying issue that I want to prevent!

The post mentioned before cover the problem to UWP app in a pc, with is not an issue for me because if the user clicks the X in the up-right corner of the window it alright that the app closes, but if the user press B button of XBOX controller accidentally and the app closes immediately, it is a very rude event of user experience, and I want that out of my app.

So, the post I mentioned before works fine for a PC, but it does not work at all in an XBOX series S. My question is how can I solve this issue? I’m sure that is not a UFO thing because every game bought in the store have this issue solved! How can I do the same?

Upvotes: 1

Views: 229

Answers (1)

user7029855
user7029855

Reputation: 21

I figure it out: preventing XBOX button B is about disable back button not about intercept a close request. So, the only thing is needed to be done is to add:

protected override bool OnBackButtonPressed() => yes;

to the page where the back button is meant to be disables

Upvotes: 1

Related Questions