Search Unity

Can't get muted and blocked users info with xbox live Unity plugin

Discussion in 'Windows' started by skyrusfxg, May 8, 2019.

  1. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    I am using xboxlive unity plugin with Unity2018.2.20f1 il2cpp backend. I am trying to pass Microsoft certification for Xbox Live. We have a chat in our game. We are using xboxlive plugin for Unity. One of the errors is: "The title allows a blocked user to continue to use text communication with the blocking user.

    I found PrivacyService class with the methods:

    Code (CSharp):
    1. public Task<IList> GetAvoidListAsync();
    2. public Task<IList> GetMuteListAsync();
    I successfully singed in to XBoxLive. I successfully got info about xboxliveuser. I works with privilegies and etc. But ... when i am trying call

    Code (CSharp):
    1. xboxliveuser.Services.PrivacyService.GetMuteListAsync().ContinueWith((task) =>
    2. {
    3.   Callback is not invoking ....((( . I never get here. No errors in logs (((
    4. }
    I tried to run it as a coroutine also... but result is the same.

    Code (CSharp):
    1. IEnumerator LoadMutedPlayersEnumerator()
    2. {
    3.    var routing = xboxliveuser.Services.PrivacyService.GetMuteListAsync().AsCoroutine();
    4.  
    5.    yield return routing;
    6.  
    7.    //I never get here
    8. }
    I have blocked and muted few xboxlive users with my xboxliveuser for tests. Some days passed since blocking (muting) them. But result is the same ((.

    What can be wrong? May be some specific settings or something else?

    Maybe this is because the application has not yet been published?
     
  2. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Ok. I tried to sign in to XBox Live this way:

    Code (CSharp):
    1. public static void InitializeXboxGamer(Action<XboxSignInData> completedCallback)
    2.     {
    3.         Log("InitializeXboxGamer starting .... ");
    4.  
    5. #if true//!UNITY_EDITOR
    6.  
    7.         UnityEngine.WSA.Application.InvokeOnUIThread(async () =>
    8.         {
    9.             _xboxliveuser = new XboxLiveUser();
    10.  
    11.             try
    12.             {
    13.                 var result = await _xboxliveuser.SignInSilentlyAsync();
    14.  
    15.                 if (result.Status == SignInStatus.UserInteractionRequired)
    16.                 {
    17.                     result = await _xboxliveuser.SignInAsync();
    18.                 }
    19.  
    20.                 var tag = _xboxliveuser.Gamertag;
    21.                 var id = _xboxliveuser.XboxUserId;
    22.                 var privilegies = _xboxliveuser.Privileges;
    23.                 var avoidUsers = string.Empty;
    24.                 var mutedUsers = string.Empty;
    25.                 var status = (int)result.Status;
    26.  
    27.                 Log("InitializeXboxGamer -> result.Status: " + result.Status + "   Gamertag: " + tag + "     XboxUserId: " + id);
    28.  
    29.                 if (result.Status == SignInStatus.Success)
    30.                 {
    31.                  
    32.                     if (_xboxliveuser.Services != null && _xboxliveuser.Services.PrivacyService != null)
    33.                     {
    34.                         Log("InitializeXboxGamer -> starting to load AvoidList ...");
    35.                         var avoidUsersList = await _xboxliveuser.Services.PrivacyService.GetAvoidListAsync();
    36.                         Log("InitializeXboxGamer -> finished loading AvoidList ...");
    37.                         if (avoidUsersList != null && avoidUsersList.Count > 0)
    38.                         {
    39.                             avoidUsers = JsonWriter.Serialize(avoidUsersList);
    40.                         }
    41.  
    42.                         Log("InitializeXboxGamer -> starting to load MuteList ...");
    43.                         var mutedUsersList = await _xboxliveuser.Services.PrivacyService.GetMuteListAsync();
    44.                         Log("InitializeXboxGamer -> finished loading MuteList ...");
    45.                         if (mutedUsersList != null && mutedUsersList.Count > 0)
    46.                         {
    47.                             mutedUsers = JsonWriter.Serialize(mutedUsersList);
    48.                         }
    49.                     }
    50.                     else
    51.                     {
    52.                         ErrorLog("InitializeXboxGamer -> _xboxliveuser.Services == null || _xboxliveuser.Services.PrivacyService == null");
    53.                     }
    54.                 }
    55.  
    56.                 Log("InitializeXboxGamer -> before UnityEngine.WSA.Application.InvokeOnAppThread ...");
    57.  
    58.                 UnityEngine.WSA.Application.InvokeOnAppThread(() =>
    59.                 {
    60.                     var res = new XboxSignInData()
    61.                     {
    62.                         GamerTag = tag,
    63.                         XboxId = id,
    64.                         Privilegies = privilegies,
    65.                         SignInResult = (SignInStatus)status,
    66.                         AvoidUsers = (string.IsNullOrEmpty(avoidUsers) ? null : JsonReader.Deserialize<List<string>>(avoidUsers)),
    67.                         MutedUsers = (string.IsNullOrEmpty(mutedUsers) ? null : JsonReader.Deserialize<List<string>>(mutedUsers)),
    68.                     };
    69.  
    70.                     fxLog.Debug(typeof(Il2cppUwpSupporter).Name, "InitializeXboxGamer -> res: " + res.ToFxJson());
    71.  
    72.                     completedCallback?.Invoke(res);
    73.  
    74.                 }, false);
    75.             }
    76.             catch (Exception e)
    77.             {
    78.                 ErrorLog(e.ToString());
    79.             }          
    80.  
    81.         }, false);
    82.  
    83. #endif
    84.  
    85.     }
    It works. I got GamerTag , xbox_id ...

    in my logs i see: "InitializeXboxGamer -> starting to load AvoidList ..."

    And it's all (( i dont see log "InitializeXboxGamer -> finished loading AvoidList ..." The game freezes.

    Maybe this is because the application has not yet been published? I had similar problems with the windows store when application has not yet been published. Nobody releases games for the xbox using XboxLivePlugin for unity? No one faced with such problems?
     
  3. Mullan7

    Mullan7

    Joined:
    May 23, 2013
    Posts:
    79
    Certain features are restricted with this plugin. Online play is one of them. I have no idea if that includes chat or not, but that could be the problem.

    Unless you're on ID@Xbox. But in that case this plugin is intended for Creators Program only I think
     
  4. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    I got mail from idds@xbox.com: "I don’t know if I will be able to provide support for this, as it deals directly with the Unity plugin wrapped API. This is owned and developed exclusively by Unity, so you will have to reach out to them to get the support you need."

    Is that true? Unity developers?

    My question about:

    Code (CSharp):
    1. xboxliveuser.Services.PrivacyService.GetMuteListAsync().ContinueWith((task) =>
    2. {
    3.   Callback is not invoking ....((( . I never get here. No errors in logs ((
    4. }
    How to make it working?
     
    Last edited: May 21, 2019
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
  6. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Only when i rewrote all (Xbox logic) on C++ side of my UWP App it started to work