Forum Discussion
MiddleMan82
2 years agoStart Partner
Clarity on what I need to do with the User Age Group API
My app is for mixed ages, so I understand I need to use the API to get the age group of the user. But what am I meant to do with that information?
The only platform services I use are the leaderboard and getting the username for the leaderboard. I've seen here (Platform Solutions: Unity | Oculus Developers) that an app which is primarily for children under 13 can't use leaderboards. But what about an app for a mixed age group?
Do I just simply need to check the age?
Do I need to disable the leaderboard if the user under 13?
Do I need to close the app if they are under 10?
None of this is clear in the docs. Please tell me what is required.
27 Replies
- zeshowStart Partner
I have the same question. Following.
- DFM31Explorer
Great questions! I wish I can help you, but I too am stuck in your same situation. My app is a mixed age app, but it does not use any type of platform services. It doesn't have any in-app ads or anything like that. Meta blindly asks that we implement their user age API but does not show or describe how/where to do it. It's so infuriating! I just added UserAgeCategory.Report(AppAgeCategory.Ch); to a scene builder script in a Start() method. That's all I could think of doing. However, who knows if that complies with their requirements.
- zeshowStart Partner
Since the documentation said that we must choose one of two methods, and "This API should only be used if you know the date of birth (including the day, month, and year) of the user." I don't have date of birth info from the players, then I guess i need to use UserAgeCategory.Get()
go I call:
UserAgeCategory.Get().OnComplete(GetUserAgeCallBack);
and then for callback:
void GetUserAgeCallBack(Message<UserAccountAgeCategory> msg)
but msg.IsError would always show an error. So I can't verify whether i have successfully retrived the user age category. And I also don't know what we are supposed to do with this age cat value after we retrieve it. Do we simply call the get function, and that's all we need to do?
- MiddleMan82Start Partner
It looks like you are doing the code right. You need to grant the app access to the user age group on your Meta development page for the app. It's under Requirements/Data Use Checkup. I was getting an error until Meta had approved that.
I still don't know what to do with the info though. I'm sure I read somewhere that they will check if we are calling it, but won't check anything else, so until I get a clear answer from them that's all I can do for now. And since Meta really don't care about small developers anymore, I doubt we will get an answer.
- bpearsExplorer
I agree with the frustrations here. Here is what I am about to implement. Hope this helps. Uses language locale and considers app content rating in that locale which you will have to hard code like I did, and varies depending on your app. Also caches entitlement and if the age was appropriate in player prefs. Then you can reference it offline and throughout your app and only have to run this on the load screen. Useful to check age category later in the game if you have achievements/leaderboards etc so you don't use them if it's a child.
void Awake() { try { Core.AsyncInitialize(); Entitlements.IsUserEntitledToApplication().OnComplete(EntitlementCallback); UserAgeCategory.Get().OnComplete(GetUserAgeCallBack); } catch (UnityException e) { Debug.LogError("Platform failed to initialize exception."); Debug.LogException(e); } if (PlayerPrefs.HasKey("ageIsOk")) { if(PlayerPrefs.GetInt("ageIsOk") == 1) { ageIsOK = true; } else { ageIsOK = false; userAgeErrorUI.SetActive(true); } } else { ageIsOK = false; } if (PlayerPrefs.HasKey("isEntitled")) { if (PlayerPrefs.GetInt("isEntitiled") == 1) { entitled = true; } else { entitled = false; entitlementErrorUI.SetActive(true); } } else { entitled = false; } } void Update(){ if(entitled && ageIsOk) { //run app } }private void GetUserAgeCallBack(Message<UserAccountAgeCategory> msg) { var uaac = msg.GetUserAccountAgeCategory(); if (!msg.IsError) { string location = Oculus.Platform.Users.GetLoggedInUserLocale(); int minAge; if (location.ToUpper().Contains("EN-US") || location.ToUpper().Contains("KO") || location.ToUpper().Contains("EN-AU") || location.ToUpper().Contains("PT-BR")) { minAge = 10;//child } else if (location.ToUpper().Contains("DE")) { minAge = 12;//child } else { minAge = 16;//teen } if (uaac.AgeCategory == AccountAgeCategory.Ch) { UserAgeCategory.Report(AppAgeCategory.Ch); PlayerPrefs.SetString("ageCategory", "Ch"); if (minAge < 13) { ageOK = true; PlayerPrefs.SetInt("ageIsOk", 1); } else { ageOK = false; PlayerPrefs.SetInt("ageIsOk", 0); } } else if (uaac.AgeCategory == AccountAgeCategory.Tn) { UserAgeCategory.Report(AppAgeCategory.Nch); PlayerPrefs.SetString("ageCategory", "Nch"); ageOK = true; PlayerPrefs.SetInt("ageIsOk", 1); } else if (uaac.AgeCategory == AccountAgeCategory.Ad) { UserAgeCategory.Report(AppAgeCategory.Nch); PlayerPrefs.SetString("ageCategory", "Nch"); ageOK = true; PlayerPrefs.SetInt("ageIsOk", 1); } } else { Debug.Log(msg.GetError()); } } private void EntitlementCallback(Message msg) { if (!msg.IsError) { PlayerPrefs.SetInt("isEntitled", 1); } else { PlayerPrefs.SetInt("isEntitled", 0); } } - zeshowStart Partner
I got my issue resolved. So I just did a simple call of the function UserAgeCategory.Get(); once at the beginning of the app. and that's all. I submitted the new build, grant the app access to the user age group. I did not do anything else after retrieving the ageCategory data from Meta.
Meta approved it within 2 days. Not sure what's the point of all this, but maybe it's for some legal issue, or perhaps they will enforce something more stringent in the future. But at least it's resolved for now.
- javicii_newHonored Guest
Have you not even needed to call a callback afterwards?
Has just adding that line of code been enough?
thanks for your help- zeshowStart Partner
No callback needed. Yeah it's kinda pointless but maybe they have plans on the future for more age specific features, and trying to get all developers to hook up to their API.
- SweetfyreProtege
Is there a special "is using" that is needed for this to function?
We are trying to use the UserAgeCatagory.Get but it just says it doestn' exist. We updated to oculus platform SDK version 63 via the meta dev hub.
We currently have thisusing Oculus.Platform;using Oculus.Platform.Models;
If not that it seems like the SDK did not actually update?- DFM31Explorer
Try calling Oculus.Platform.Core.Initialize(); before you call the user age category API:
Oculus.Platform.Core.Initialize();
UserAgeCategory.Get();
UserAgeCategory.Report(AppAgeCategory.Ch);- SweetfyreProtege
Thanks for the reply, I am doing Oculus.Platform.Core.Initialize();
The problem is it wont even compile because:The type or namespace name 'UserAgeCategory' could not be found (are you missing a using directive or an assembly reference?)
But it sounds like you are not using any special "using".?
- javicii_newHonored Guestyou should have a UserAgeCategory class in the platform.cs script. If you don't have it, you probably don't have a correct version of the sdk.All the best
- Liam2010Honored Guest
what sdk do i need and what version maby a link?
- SweetfyreProtege
In case you didn't figure it out yet, our workaround was to download the oculus integration package and import only the Oculus Platform SDK part of it into our current project. That gave us a high enough version to have the age stuff.
Then you implement their example code on start, make a build and run it on quest (not in the editor). We didn't have to push or upload our build. They approved it the next morning after just running it.
- SweetfyreProtege
Thanks for the reply!
We upgraded our Oculus Platform SDK to v63 via the dev hub, but our platform.cs script does NOT contain the UserAgeCategory class.
Do we need to upgrade it from somewhere else?
As a note we don't have the Oculus Integration package installed, we are not using that.
Thanks again for the help! We are running out of time on this.
- zeshowStart Partner
I am using the meta XR SDK ver 59.0. not the oculus SDK. (I updated from the oculus SDK to meta XR sdk before). Maybe you should try changing to meta XR SDK instead of the oculus SDK.
These are the namespaces I am using:
using Oculus.Platform;
using Oculus.Platform.Models;Hope that helps
- SweetfyreProtege
We haven't yet migrated to meta XR SDK. But we now have a solution. Even though the meta dev hub says oculus platform 63 is installed it clearly is not in our project. So we just downloaded the oculus integration package (depreciated) and installed the platform section from that. Which includes the latest Platform SDK, and that did update it in this project.
So now it does find the age related code! Thanks for your help!This begs the question why does the dev hub think we have Oculus platform installed and what is it even installed for.
- DFM31Explorer
Sadly, I couldn't get the user age group API to comply with Meta and they took my app off the store. I ended up changing it to a 13 to adult app to at least get it back up.
I added the api get call as requested which runs once per session. I'm not sure what else needs to be done. Testing seems to be difficult (i.e. creating a fake account with different age groups and running the app). Perhaps, I need to allow internet access within my manifest. My app doesn't need internet access and shouldn't be allowed based on least privilege rules. I don't know, there's something assumed that Unity and Meta won't include in their documentation, but I am at a loss...
- SweetfyreProtege
Hi there! We had issues that they helped us resolve too. If you fill out a form in the Start program and also join the start program they can help you easier.
Here is where to find the form to fill out: https://oculusdevelopers.zendesk.com. Then click on "contact us" at the top left of the page next to your profile.
Hope this can help!
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 19 days ago
- 2 years ago
- 2 months ago