License management for user module?

I would like to provide module with a license system.
A free 2H demo mode like ignition and a full licensed version limited to a single gateway.
How to configure the module ?

Get the LicenseManager from GatewayContext.

Add a LicenseStateUpdateListener to get notified when any changes to the license occur, including whether or not the 2 hour trial has expired (LicenseState#isTrialExpired()).