Has Anyone Got plugin.ageRange Working?

I’m trying to get the ageRange plugin up and running on my Android apps, but I’m getting an insta-crash the moment I call ageRange.requestAgeRange().

I’m using the latest version of Solar2D, and implementing everything straight out of the docs.

The docs mention that gpgs needs to be running for ageRange to work, so I suspect my implementation of that might be the problem. I haven’t used it previously, and there are many hoops to setting it up that I’m working through. (I can feel the migraine coming on as I get directed to set up a Google Cloud Services account…)

Anyway, if anyone has got it working and can send me, at the bare minimum, words of encouragement that it actually works and, by preference, implementation tips, I’d be grateful.

As a point of discussion - why do you need this? I mark my games as 18+ on the stores as I don’t need the aggravation - doesn’t seems to stop kids installing of course!

So what is the reasoning for an age-based plugin and what does it actually offer?

The point is that Texas passed a law, and the app stores are enforcing it. The law is being challenged in the courts, but a judge just ruled that the law is in effect during the challenges, so we need to comply or risk having our apps delisted.

Let’s not turn this thread into a referendum on lawmakers’ shortcomings when it comes to regulating technology- there are many, so let’s just take it as read. :grin:

I’m trying to solve a technical problem.

I think a lot of stuff was in beta when I was working on the plugin, will take a look

2 Likes

Thanks, Scott!

@colinmorgan pushed fix for this

2 Likes

Thanks, Scott!

It works on Android now. (Google is returning nil, nil, empty, but at least the act of calling ageRange.requestAgeRange() no longer causes the device to crash.)

@Scott_Harrison Can you please work your magic on the iOS version? It crashes in the exact same place. (I can’t speak to Amazon- I haven’t tried it yet.)

@colinmorgan is this an older iOS device that is crashing on?

Good call. Looks like it crashes on versions of iOS prior to iOS 26.

It would be nice if it could just fail silently because that will undoubtedly catch some folks, but I’ll just version gate the function, so that works.*

Thanks, Scott!

*”Works” being a relative term since it returns “Age range not available”, but that’s just as likely an Apple problem as anything else.

@colinmorgan good point, did not know it was crashing, added gate and warning for older iOS versions

Senior devs normally code against what can go wrong before coding the what can go right. Always assume the API will fail, an object will be nil and employ defensive coding. It saves a lot of time and effort in the future!

Thanks, Scott- you’re the best!

Quick iOS update.

In build.settings, ["com.apple.developer.declared-age-range"] = true, needs to be an entitlement, not a plist item. (I’ve added this as an issue on GitHub.)

Developers will also need to add the Declared Age Range entitlement to their app’s Identifiers and create a new Provisioning Profile.

Having made these changes, the ageRange plugin on iOS now works as expected.