How can a UWP / C # application register with an XBox user and display gamertag?

I am trying to resubmit a UWP application (written in C # / XAML) to a Microsoft repository 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 application on my Xbox One console in developer mode without any problems. When I send to the store, I get the following error:

Since your game uses Xbox Live, it must:
   ยท Create at least one active user and sign up for the user on Xbox.
   ยท Display Xbox gamertag users 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 send problem.

The Raw Gamer Profile "profile access message 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 can determine if the application is running on Xbox.

In addition, I would like to know how and where I should display the user game server. Can I just display it anywhere in XAML? Also, is there any special Xbox api I need to call in order to display this?

, #/XAML, , , , Xbox, , Microsoft Store.

Update: :

Nuget, Microsoft.Xbox.Live.SDK.WinRT.UWP\

xboxservices.config 6

TextBlock 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;
    }
}

:

: 10.13.5 Xbox Live Active User Gamertag

Xbox Live, : ยท Xbox. ยท Xbox gamertag . , . Xbox Live . , .

: Windows 10 Desktop, Windows 10 Xbox

, ?

+4
5

, , Windows, Microsoft Store Xbox One. (. ) , , gamertag .

Xbox "Xbox Live" ( ), " " . , ID @XBOX

, "Xbox Live" UWP, , gamertag :

, ( - > ) " Windows 10 (10.0; Build 15063)" "Windows 10 Fall Creators Update (10.0; Build 16299)" - "Microsoft.Xbox.Services.winmd" NuGet .

Visual Studio Nuget, Microsoft.Xbox.Live.SDK.WinRT.UWP

xboxservices.config 6 .

TextBlock, gamertag. , gamertag:

public static async void InitializeXboxGamer(TextBlock gamerTagTextBlock)
{
    try
    {
        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;
    }
    catch (Exception ex)
    {
        // TODO: log an error here
    }
}

MainPage().

( Windows 10), .

developer.windows.com, , , "", "Xbox Live" " Xbox Live ", ,

, "" "Xbox Live".

+2

Xbox , :

if ( Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily.Contains( "Xbox" ) )
{
   //do your Xbox specific actions
}

.

0

UWP Xbox, Windows 10 Cert. , . UWP, Xbox Live Xbox.

, Xbox, ( , Xbox Live / ).

/ Xbox live, , .

, .

0

Xbox Live? ? , , .

0
source

just wondering, did you find a way to sign Xbox Live users on non-Xbox devices - like web / windows?

We have a similar UWP app on the XBox, and our users need to download it on the Xbox so that we can ping their Xbox Live account. This would make life easier if they could do the same on web / windows devices.

0
source

Source: https://habr.com/ru/post/1692188/


All Articles