microsoft / gdk-unity-package

The Unity package for PC GDK developers.
Other
51 stars 18 forks source link

Impossible to Clear rich presence #122

Open damsku opened 1 year ago

damsku commented 1 year ago

When the title exits, it seems impossible to clear the rich presence status so XBox app shows the last status forever (or at least a very long time). I tried to pass null or empty strings but that did not help and I can't find a dedicated clear API, releasing the GDK does not help either.

edwarduwms commented 1 year ago

Thanks for your patience.

Titles can’t clear the entire string it would reset to “Playing ”. To achieve this you would need to call XblPresenceSetPresenceAsync with a nullptr for the XblPresenceRichPresenceIds array. Also note that presence can be very slow to update, there are no guarantees around timing on that service, so it shouldn't be used for any time sensitive / potentially rapidly changing data. And 'clearing' it can take time to be reflected in the shell/gamebar too.

damsku commented 1 year ago

Hi,

I am actually already doing this as the code hinted this may reset the rich presence string but it does not seem to matter. While changing the state in-game, there is about 10s latency to see the update (not accurate but this is relatively fast) but when exiting the title (terminating the process) I call the rich presence API with null presence ids (waiting and checking for the hr of the callback) and that one does not update within 10s (which roughly check out with the expected limits documented), XBox app shows last status "In Main-menu" for a long time (can be tens of minutes or hours, I suppose it depends what else may trigger a state update like logging on xbox or something). I expect the status to clear under a minute delay as it is quite misleading to show other players one is still playing hours after they have closed the game. Also, I clean up the GDK and XBL API and wait for the callbacks that return successful hr, I originally expected this would automagically clear the rich presence too. I haven't been able to check on XBox yet but as far as I am aware, it is not an issue with the Gamecore GDK unity counterpart. I will confirm this when I can.