I am trying to resubmit a UWP app (written in C#/XAML) into the Microsoft store so that it supports "Windows 10 Xbox" in addition to the previously supported Windows Desktop and Windows Phone. I can deploy (using Visual Studio 2017) and run the app on my Xbox One console in Developer Mode with no problems. When I submit to the store, I get the following error:
Because your game uses Xbox Live, it must:
· Create at least one active user and sign the user into Xbox.
· Display the user’s Xbox gamertag as the primary display and profile name.Please add this behavior and resubmit your game.
I am looking for a minimal C#/XAML example that shows me how to solve this submission problem.
The post on "Accessing Raw Gamer Profile Picture" seems to indicate that I can take care of the login by doing something like this:
if (App is running on Xbox)
{
XboxLiveUser user = new XboxLiveUser();
SignInResult result = await user.SignInAsync();
}
but I'm not sure if this is correct, or how I would determine that the app is running on Xbox.
Also, I would like to know how and where I am supposed to display the user's gamertag. Can I just display it anywhere in the XAML? Alternatively, is there some special Xbox api I need to call to display this?
In short, I need a very simple C#/XAML example that shows how to do the minimal requirements of checking to see if the app is running on Xbox, logging in the user, and then displaying the user's gamertag in the appropriate place, so that I satisfy the Microsoft Store requirements.
Update: I did the following:
Using Nuget Package Manager, I installed Microsoft.Xbox.Live.SDK.WinRT.UWP\
In the project, I created an xboxservices.config file following Section 6 of these instructions
I created a TextBlock control at upper left side of my screen, and passed it in to the following function to display the gamertag:
public static async void InitializeXboxGamer(TextBlock gamerTagTextBlock)
{
if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily.Contains("Xbox"))
{
XboxLiveUser user = new XboxLiveUser();
SignInResult result = await user.SignInSilentlyAsync(Window.Current.Dispatcher);
if (result.Status == SignInStatus.UserInteractionRequired)
{
result = await user.SignInAsync(Window.Current.Dispatcher);
}
gamerTagTextBlock.Text = user.Gamertag;
gamerTagTextBlock.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
else
{
gamerTagTextBlock.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
}
However, this still failed to pass submission tests with the following error:
App Policies: 10.13.5 Xbox Live Active User and Gamertag
Notes To Developer
Because your game uses Xbox Live, it must: · Create at least one active user and sign the user into Xbox. · Display the user’s Xbox gamertag as the primary display and profile name. Please add this behavior and resubmit your game. You can view the Xbox Live documentation for more information. Your game may not appear in the Creators Collection until this has been resolved.
Tested Devices: Windows 10 Desktop, Windows 10 Xbox
Any ideas on what I'm doing wrong here?