InAppPurchases::Listener Struct Reference
juce_product_unlocking » in_app_purchases

Represents an object that gets notified about events such as product info returned or product purchase finished. More...

## Classes

struct | PurchaseInfo
| Structure holding purchase information. More...

## Public Member Functions

virtual | ~Listener ()
virtual void | productsInfoReturned (const Array< Product > &)
| Called whenever a product info is returned after a call to InAppPurchases::getProductsInformation(). More...
virtual void | productPurchaseFinished (const PurchaseInfo &, bool, const String &)
| Called whenever a purchase is complete, with additional state whether the purchase completed successfully. More...
virtual void | purchasesListRestored (const Array< PurchaseInfo > &, bool, const String &)
| Called when a list of all purchases is restored. More...
virtual void | productConsumed (const String &, bool, const String &)
| Called whenever a product consumption finishes. More...
virtual void | productDownloadProgressUpdate (Download &, float, RelativeTime)
| iOS only: Called when a product download progress gets updated. More...
virtual void | productDownloadPaused (Download &)
| iOS only: Called when a product download is paused. More...
virtual void | productDownloadFinished (Download &, const URL &)
| iOS only: Called when a product download finishes (successfully or not). More...

## Detailed Description

Represents an object that gets notified about events such as product info returned or product purchase finished.

## Constructor & Destructor Documentation

## ~Listener()

virtual InAppPurchases::Listener::~Listener | ( |  | ) |

virtual

## Member Function Documentation

## productsInfoReturned()

virtual void InAppPurchases::Listener::productsInfoReturned | ( | const Array< Product > & |  | ) |

virtual

Called whenever a product info is returned after a call to InAppPurchases::getProductsInformation().

## productPurchaseFinished()

virtual void InAppPurchases::Listener::productPurchaseFinished | ( | const PurchaseInfo & | ,
|  | bool | ,
|  | const String & |
| ) |  |

virtual

Called whenever a purchase is complete, with additional state whether the purchase completed successfully.

For hosted content (iOS only), the downloads array within PurchaseInfo will contain all download objects corresponding with the purchase. For non-hosted content, the downloads array will be empty.

InAppPurchases class will own downloads and will delete them as soon as they are finished.

NOTE: It is possible to receive this callback for the same purchase multiple times. If that happens, only the newest set of downloads and the newest orderId will be valid, the old ones should be not used anymore!

## purchasesListRestored()

virtual void InAppPurchases::Listener::purchasesListRestored | ( | const Array< PurchaseInfo > & | ,
|  | bool | ,
|  | const String & |
| ) |  |

virtual

Called when a list of all purchases is restored.

This can be used to figure out to which products a user is entitled to.

NOTE: It is possible to receive this callback for the same purchase multiple times. If that happens, only the newest set of downloads and the newest orderId will be valid, the old ones should be not used anymore!

## productConsumed()

virtual void InAppPurchases::Listener::productConsumed | ( | const String & | ,
|  | bool | ,
|  | const String & |
| ) |  |

virtual

Called whenever a product consumption finishes.

## productDownloadProgressUpdate()

virtual void InAppPurchases::Listener::productDownloadProgressUpdate | ( | Download & | ,
|  | float | ,
|  | RelativeTime |
| ) |  |

virtual

iOS only: Called when a product download progress gets updated.

If the download was interrupted in the last application session, this callback may be called after the application starts.

If the download was in progress and the application was closed, the download may happily continue in the background by OS. If you open the app and the download is still in progress, you will receive this callback. If the download finishes in the background before you start the app again, you will receive productDownloadFinished callback instead. The download will only stop when it is explicitly cancelled or when it is finished.

## productDownloadPaused()

virtual void InAppPurchases::Listener::productDownloadPaused | ( | Download & |  | ) |

virtual

iOS only: Called when a product download is paused.

This may also be called after the application starts, if the download was in a paused state and the application was closed before finishing the download.

Only after the download is finished successfully or cancelled you will stop receiving this callback on startup.

## productDownloadFinished()

virtual void InAppPurchases::Listener::productDownloadFinished | ( | Download & | ,
|  | const URL & |
| ) |  |

virtual

iOS only: Called when a product download finishes (successfully or not).

Call Download::getStatus() to check if the downloaded finished successfully.

It is your responsibility to move the download content into your app directory and to clean up any files that are no longer needed.

After the download is finished, the download object is destroyed and should not be accessed anymore.

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

- juce_InAppPurchases.h