StoreContext.GetAppLicenseAsync().AddOnLicenses sometimes returns an empty list when the user has a license

64 Views Asked by At

I have an XBOX only app in the Microsoft Store that has been up for a while. The app has an add-on.

I use a very simple code to get the list of licenses in order to check if the user has add-on. See below.

StoreAppLicense appLicense = await StoreContext.GetAppLicenseAsync();

var licenses = appLicense.AddOnLicenses.Select(item=> item.Value).ToList();

//Here I just save this in my log to see what is in the list
LogInfo("licenses: " + string.Join(',', licenses.Select(l => l.SkuStoreId).ToArray()));

Ok, so most of the time this code works fine. But there can be instances where the StoreAppLicense returns an empty list, even when the user HAS the license.

This has been a problem that has happened sometimes since I published the add-on, but was always fixed by reinstalling the app. Lately, even after a reinstall; the issue reappears.

What is worst, this even happened to me two days ago. I reinstalled the app and it worked fine; but after restarting the app it happened again. Then after some hours when I came back home it "solved itself".

I also have the suspicion that sometimes the StoreContext.GetAppLicenseAsync() method never returns and that causes the app to "hang".

Needless to say, customers get upset at me and give me bad reviews for something that is beyond my control.

What should I do in this situation? Can you even trust the StoreContext library? Has someone seen this happening before?

0

There are 0 best solutions below