InApps Android
Classes | Public Member Functions | List of all members
com.ludei.inapps.InAppService Interface Reference

Represents the InApp Service. More...

Inherited by com.ludei.inapps.AbstractInAppService.

Classes

interface  ConsumeCallback
 Informs when a product is consumed properly or when the process fails. More...
 
class  Error
 A class representing an error message. More...
 
interface  FetchCallback
 The fetch callback returns a list of the fetched products or an error if the process fails. More...
 
interface  InAppPurchaseObserver
 Informs about the purchasing process. More...
 
interface  InitCompletion
 Informs when the service is fully initialized and ready to use. More...
 
interface  PurchaseCallback
 Informs when a purchase is completed or when the process fails. More...
 
interface  RestoreCallback
 Informs when the restoration process fails. More...
 
interface  ValidationCompletion
 Informs if the Validation is completed or there was an error in the proccess. More...
 
interface  ValidationHandler
 Provides information about the validation proccess. More...
 

Public Member Functions

void init (InitCompletion callback)
 Initialize the service and wait for completion Some IAP services like Google Play need to initialize external services. More...
 
void addPurchaseObserver (InAppPurchaseObserver observer)
 Adds a purchase observer. More...
 
void removePurchaseObserver (InAppPurchaseObserver observer)
 Removes a purchase observer. More...
 
void fetchProducts (List< String > productIds, FetchCallback callback)
 Fetches given the list of products from the remote server. More...
 
List< InAppProductgetProducts ()
 Gets the list of all the local products. More...
 
InAppProduct productForId (String productId)
 Returns the product of the given product id. More...
 
boolean isPurchased (String productId)
 Returns true if the product has been purchased and false otherwise. More...
 
int stockOfProduct (String productId)
 Returns the current stock of a given product. More...
 
void restorePurchases (RestoreCallback callback)
 Restores the purchases linked to the user account. More...
 
boolean canPurchase ()
 Returns true if the store service is avaialable and false otherwise. More...
 
void purchase (String productId, PurchaseCallback callback)
 Purchases the product. More...
 
void purchase (String productId, int quantity, PurchaseCallback callback)
 Purchases the product. More...
 
void consume (String productId, int quantity, ConsumeCallback callback)
 Consumes a consumable product already purchased. More...
 
void setValidationHandler (ValidationHandler handler)
 Sets the custom validation handler to validate the purchasing process. More...
 
void setLudeiServerValidationHandler ()
 Use Ludei's server to validate purchases. More...
 
boolean onActivityResult (int requestCode, int resultCode, Intent data)
 Call it when you receive onActivityResult method in your activity. More...
 
void onDestroy ()
 Call it when the activity is destroyed.
 

Detailed Description

Author
Imanol Fernández
Version
1.0

Member Function Documentation

void com.ludei.inapps.InAppService.addPurchaseObserver ( InAppPurchaseObserver  observer)
Parameters
observerThe purchase observer to add.
boolean com.ludei.inapps.InAppService.canPurchase ( )
Returns
A booblean that will be true if the store service is available and false otherwise.
void com.ludei.inapps.InAppService.consume ( String  productId,
int  quantity,
ConsumeCallback  callback 
)
Parameters
productIdThe product id of the product to consume.
quantityThe quantity of the product to consume.
callbackThe consume callback.
void com.ludei.inapps.InAppService.fetchProducts ( List< String >  productIds,
FetchCallback  callback 
)
Parameters
productIdsA list of product ids.
callbackThe fetch callback.
List<InAppProduct> com.ludei.inapps.InAppService.getProducts ( )
Returns
A list of products.
void com.ludei.inapps.InAppService.init ( InitCompletion  callback)
Parameters
callbackInforms when the service is fully initialized and ready to use
boolean com.ludei.inapps.InAppService.isPurchased ( String  productId)
Parameters
productIdThe product id to check.
Returns
A boolean that is true is the product is purchased and false otherwise.
boolean com.ludei.inapps.InAppService.onActivityResult ( int  requestCode,
int  resultCode,
Intent  data 
)
Parameters
requestCodeThe request code.
resultCodeThe result code.
dataThe data of the activity result.
Returns
A boolean containing the result of the activity.
InAppProduct com.ludei.inapps.InAppService.productForId ( String  productId)
Parameters
productId
Returns
The product with the given id.
void com.ludei.inapps.InAppService.purchase ( String  productId,
PurchaseCallback  callback 
)
Parameters
productIdThe product id of the product to purchase.
callbackThe purchase callback.
void com.ludei.inapps.InAppService.purchase ( String  productId,
int  quantity,
PurchaseCallback  callback 
)
Parameters
productIdThe product id of the product to purchase.
quantityThe quantity of the product.
callbackThe purchase callback.
void com.ludei.inapps.InAppService.removePurchaseObserver ( InAppPurchaseObserver  observer)
Parameters
observerThe purchase observer to remove.
void com.ludei.inapps.InAppService.restorePurchases ( RestoreCallback  callback)
Parameters
callbackThe restore callback.
void com.ludei.inapps.InAppService.setLudeiServerValidationHandler ( )

To enable validatioon using Ludei's server you first need to create an account in Ludei's Cloud server and create a project with you bundleId.

void com.ludei.inapps.InAppService.setValidationHandler ( ValidationHandler  handler)
Parameters
handlerThe validation handler
int com.ludei.inapps.InAppService.stockOfProduct ( String  productId)
Parameters
productIdThe product id to check.
Returns
An int representing the stock of the product.

The documentation for this interface was generated from the following file: