Class Information

java.lang.Object
com.badlogic.gdx.pay.Information

public final class Information extends Object
Information about a product that can be purchased provided by a purchase manager. Some methods will return 'null' if requested information is not available.
  • Field Details

    • UNAVAILABLE

      public static final Information UNAVAILABLE
      The information returned if a purchase manager does not support information.
  • Constructor Details

    • Information

      public Information(String localName, String localDescription, String localPricing)
  • Method Details

    • newBuilder

      public static Information.Builder newBuilder()
    • getPriceInCents

      @Deprecated @Nullable public Integer getPriceInCents()
      Deprecated.
      Not all currencies use cents. Currencies with no or more than 2 fractional digits exist. Use getPriceAsDouble() instead.
      Price in cents.

      Caution: this field could be null, information is not always available!

    • getFreeTrialPeriod

      @Nullable public FreeTrialPeriod getFreeTrialPeriod()
      Returns:
      null if there is no free trial or the implementation does not support free trials.
    • getPriceAsDouble

      @Nullable public Double getPriceAsDouble()
      Price (as a double).

      Caution: this field could be null, information is not always available!

      Use Currency.getDefaultFractionDigits() to format the price with the correct number of fraction digits for its currency:

       NumberFormat priceFormat = NumberFormat.getCurrencyInstance(yourUsersLocale);
       Currency currency = Currency.getInstance(information.getCurrencyCode());
       priceFormat.setCurrency(currency);
       priceFormat.setMaximumFractionDigits(currency.getDefaultFractionDigits());
       priceFormat.setMinimumFractionDigits(currency.getDefaultFractionDigits());
       priceFormat.format(information.getPriceAsDouble());
       

      Note that this will not always output the currency symbol (e.g. €), but use the currency code (e.g. EUR) instead.

    • getPriceCurrencyCode

      public String getPriceCurrencyCode()
      Price currency code.

      Caution:Note that not all PurchaseManagers set this field!

      Returns:
    • getLocalName

      public String getLocalName()
      Returns the localized product name or null if not available (PurchaseManager-dependent).
    • getLocalDescription

      public String getLocalDescription()
      Returns the localized product description or null if not available (PurchaseManager-dependent).
    • getLocalPricing

      public String getLocalPricing()
      Returns the localized product price or null if not available (PurchaseManager-dependent).
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object