Setting LicenseState for a custom module

Hello, I made a custom module and it’s working great, but when I install on the gateway the the License shown is trial: I tried to figure out how to set the kind of license inside the code, but I can’t really understand how it’s done. Looking at the classes and the documentation, the objects that are retrievable from the custom ModuleHook class can only get informations regarding the state of the license, but I cannot find a way to set the state of the license. In this page:

are listed some of the basic classes representing basic kinds of licenses: there’s a FreeLicenseState that I guess is what I need, but how to use it?
For example, I tried to override the startup method in my ModuleHook class:

    public void startup(@NotNull LicenseState activationState) {
        super.startup(new FreeLicenseState());

but it’s now working. Anyone knows how to do it?
Thanks in advance,

You don’t set the license state.

Your module can either indicate it’s free or otherwise it receives the license state from the platform. A non-free module is only licensed if it’s actually present on the license.

Hello thanks for replying. So how can I set the module as a free module? Basically I just need to hide the Trial state that is listed in the modules status page on the gateway.

Override isFreeModule() in GatewayModuleHook and return true.

Also, if you want it to work on Maker, you’ll need to override isMakerEditionCompatible in the same place (as long as you’re building against an SDK target of 8.0.14 or higher).

Many thanks, it’s simpler than I thought :slight_smile: