Class MeteredLicense


  • public class MeteredLicense
    extends Object

    Provides methods to set metered key.


    In this example, an attempt will be made to set metered public and private key.
    
     	MeteredLicense metered = new MeteredLicense();
     	metered.setMeteredKey("PublicKey", "PrivateKey");
     

    Important: with metered license you cannot compose self-extracting zip archives.

    • Constructor Detail

      • MeteredLicense

        public MeteredLicense()
    • Method Detail

      • getConsumptionCredit

        public static BigDecimal getConsumptionCredit()
                                               throws Exception

        Gets consumption credit.

        Returns:
        Returns the number of consumed credit points.
        Throws:
        Exception
      • getConsumptionQuantity

        public static BigDecimal getConsumptionQuantity()
                                                 throws Exception

        Gets consumption file size.

        Returns:
        Returns the number of consumed bytes.
        Throws:
        Exception
      • isLicensed

        public final boolean isLicensed()

        Checks whether the product is successfully licensed using Metered license.

        Returns:
        true or false
      • resetMeteredKey

        public final void resetMeteredKey()

        Removes previously setup license.

      • setMeteredKey

        public final void setMeteredKey​(String publicKey,
                                        String privateKey)

        Sets metered public and private keys.

        If you purchase metered license, this API should be called on application startup, normally, this is enough. However, if metered fails to upload consumption data during 24 hours period, the license will be set to evaluation status. To avoid such case, you should regularly check the license status If it is evaluation status, call this API again.

        Parameters:
        publicKey - The public key.
        privateKey - The private key.