Package com.badlogic.gdx.pay
Class Information
java.lang.Object
com.badlogic.gdx.pay.Information
Information about a product that can be purchased provided by a purchase manager. Some methods
will return 'null' if requested information is not available.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final InformationThe information returned if a purchase manager does not support information. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the localized product description or null if not available (PurchaseManager-dependent).Returns the localized product name or null if not available (PurchaseManager-dependent).Returns the localized product price or null if not available (PurchaseManager-dependent).Price (as a double).Price currency code.Deprecated.Not all currencies use cents.inthashCode()static Information.BuildertoString()
-
Field Details
-
UNAVAILABLE
The information returned if a purchase manager does not support information.
-
-
Constructor Details
-
Information
-
-
Method Details
-
newBuilder
-
getPriceInCents
Deprecated.Not all currencies use cents. Currencies with no or more than 2 fractional digits exist. UsegetPriceAsDouble()instead.Price in cents.Caution: this field could be null, information is not always available!
-
getFreeTrialPeriod
- Returns:
- null if there is no free trial or the implementation does not support free trials.
-
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
Price currency code.Caution:Note that not all PurchaseManagers set this field!
- Returns:
-
getLocalName
Returns the localized product name or null if not available (PurchaseManager-dependent). -
getLocalDescription
Returns the localized product description or null if not available (PurchaseManager-dependent). -
getLocalPricing
Returns the localized product price or null if not available (PurchaseManager-dependent). -
equals
-
hashCode
public int hashCode() -
toString
-