Murl::IAppStoreControl Interface Referenceabstract

The IAppStoreControl interface. More...

#include "murl_i_app_store_control.h"

Inheritance diagram for Murl::IAppStoreControl:

Public Types

enum  Status { STATUS_IDLE , STATUS_CONNECTING , STATUS_CONNECTED , STATUS_ERROR }
 Enumeration of the App Store connection status. More...
 

Public Member Functions

virtual Status GetStatus () const =0
 Get the App Store connection status. More...
 
virtual Bool RegisterProduct (const String &productId, IAppStoreProduct::ProductType productType)=0
 Register a product to the App Store control. More...
 
virtual Bool ConnectToStore ()=0
 Start connecting to the App Store. More...
 
virtual Bool DisconnectFromStore ()=0
 Disconnect from the App Store. More...
 
virtual Bool ReconnectToStore ()=0
 Reconnect to the App Store. More...
 
virtual Bool RestoreTransactions ()=0
 Restore any previously completed purchase transactions. More...
 
virtual Bool SwitchAppStoreImplementation (SInt32 id)=0
 Switch to a different variant of the app store controller implementation. More...
 
virtual UInt32 GetNumberOfAvailableProducts () const =0
 Get the number of available products. More...
 
virtual IAppStoreProductGetAvailableProduct (UInt32 index)=0
 Get a product by index. More...
 
virtual IAppStoreProductGetAvailableProduct (const String &productId)=0
 Get a product by identifier. More...
 
virtual Bool CanPurchaseProducts () const =0
 Check if the App Store allows to purchase products at all. More...
 
virtual Bool PurchaseProduct (IAppStoreProduct *product)=0
 Start purchasing of a product. More...
 
virtual Bool ConsumeProduct (IAppStoreProduct *product)=0
 Consume an already purchased and consumeable product. More...
 
virtual Bool ConfirmConsumedProduct (IAppStoreProduct *product)=0
 Confirm consumption of a consumed product. More...
 
virtual Bool TryCancelProduct (IAppStoreProduct *product)=0
 Try to cancel an already purchased product. More...
 
virtual const StringGetLastError () const =0
 Get the description string of the last error. More...
 
virtual Bool ClearLastError ()=0
 Clear the last error status and string. More...
 
- Public Member Functions inherited from Murl::IControlable
virtual const StringGetName () const =0
 Get the controlable's name. More...
 
virtual void FrameUpdate ()=0
 Is executed in the platform thread context each frame tick.
 
virtual void LogicUpdate ()=0
 Is executed in the logic thread context each logic tick.
 
virtual void ConfigChanged (const IAppConfiguration *appConfig)=0
 Notification of changed configuration. More...
 

Detailed Description

The IAppStoreControl interface.

Member Enumeration Documentation

◆ Status

Enumeration of the App Store connection status.

Use GetStatus() to get the current status.

Enumerator
STATUS_IDLE 

The connection is idle.

STATUS_CONNECTING 

Connecting to the App Store is in progress.

STATUS_CONNECTED 

The connection to the App Store is established.

STATUS_ERROR 

Connection error.

Member Function Documentation

◆ GetStatus()

virtual Status Murl::IAppStoreControl::GetStatus ( ) const
pure virtual

Get the App Store connection status.

The connection operation works asynchronously, the application can check the current status to operate correctly.

Returns
The App Store connection status.

◆ RegisterProduct()

virtual Bool Murl::IAppStoreControl::RegisterProduct ( const String productId,
IAppStoreProduct::ProductType  productType 
)
pure virtual

Register a product to the App Store control.

Products can only be registered before calling ConnectToStore() at least once.

Parameters
productIdThe identifier of the product.
productTypeThe type of the product.
Returns
true if successful.

◆ ConnectToStore()

virtual Bool Murl::IAppStoreControl::ConnectToStore ( )
pure virtual

Start connecting to the App Store.

When starting the connnection, the App Store status changes to IAppStoreControl::STATUS_CONNECTING immediately. When the App Store is connected the App Store status changes to IAppStoreControl::STATUS_CONNECTED. This method also resets the internal status of all registered products to either STATUS_PURCHASED or STATUS_NOT_PURCHASED.

Returns
always true.

◆ DisconnectFromStore()

virtual Bool Murl::IAppStoreControl::DisconnectFromStore ( )
pure virtual

Disconnect from the App Store.

The App Store status changes to IAppStoreControl::STATUS_IDLE immediately.

Returns
always true.

◆ ReconnectToStore()

virtual Bool Murl::IAppStoreControl::ReconnectToStore ( )
pure virtual

Reconnect to the App Store.

This method is basically identical to calling DisconnectFromStore() followed by a call to ConnectToStore(), except that the internal status of the registered products is not touched. Can be used in a logic implementation when e.g. the app run state changes to APP_RUN_STATE_RUNNING, to refresh the store connection.

Returns
always true.

◆ RestoreTransactions()

virtual Bool Murl::IAppStoreControl::RestoreTransactions ( )
pure virtual

Restore any previously completed purchase transactions.

To successfully restore any previous transactions, the current status must be IAppStoreControl::STATUS_CONNECTED.

Returns
true if successful.

◆ SwitchAppStoreImplementation()

virtual Bool Murl::IAppStoreControl::SwitchAppStoreImplementation ( SInt32  id)
pure virtual

Switch to a different variant of the app store controller implementation.

Can be used to switch between different implementations for quality testing. Currenty only implemented for the Google Play Store: Use parameter id 1 for the Google Play Billing Library version 3 (new version) Use parameter id 0 for the InAppBillingService version 3 (old version)

Parameters
idThe identifier of the implementation.
Returns
true if successful.

◆ GetNumberOfAvailableProducts()

virtual UInt32 Murl::IAppStoreControl::GetNumberOfAvailableProducts ( ) const
pure virtual

Get the number of available products.

The result is only valid after calling ConnectToStore() at least once.

Returns
The number of available products.

◆ GetAvailableProduct() [1/2]

virtual IAppStoreProduct* Murl::IAppStoreControl::GetAvailableProduct ( UInt32  index)
pure virtual

Get a product by index.

The result is only valid after calling ConnectToStore() at least once. A valid product index is [0 .. GetNumberOfAvailableProducts() - 1].

Parameters
indexThe zero-based index of the product.
Returns
The product object or null if index is out of range.

◆ GetAvailableProduct() [2/2]

virtual IAppStoreProduct* Murl::IAppStoreControl::GetAvailableProduct ( const String productId)
pure virtual

Get a product by identifier.

The result is only valid after calling ConnectToStore() at least once.

Parameters
productIdThe identifier of the product.
Returns
The product object or null if the identifier is not found.

◆ CanPurchaseProducts()

virtual Bool Murl::IAppStoreControl::CanPurchaseProducts ( ) const
pure virtual

Check if the App Store allows to purchase products at all.

The result is only valid after calling ConnectToStore() at least once.

Returns
true if in-app purchasing is possible.

◆ PurchaseProduct()

virtual Bool Murl::IAppStoreControl::PurchaseProduct ( IAppStoreProduct product)
pure virtual

Start purchasing of a product.

When starting a purchase, the product status changes to IAppStoreProduct::STATUS_PURCHASE_PENDING immediately. The purchase is finished when the product status is IAppStoreProduct::STATUS_PURCHASED.

Parameters
productThe product to purchase.
Returns
true if starting the purchase was successful.

◆ ConsumeProduct()

virtual Bool Murl::IAppStoreControl::ConsumeProduct ( IAppStoreProduct product)
pure virtual

Consume an already purchased and consumeable product.

A product can be consumed if the product type is IAppStoreProduct::PRODUCT_TYPE_CONSUMABLE and the product status is IAppStoreProduct::STATUS_PURCHASED. When starting a consume, the product status changes to IAppStoreProduct::STATUS_CONSUME_PENDING immediately.
The consume is finished when the product status is IAppStoreProduct::STATUS_CONSUMED, see ConfirmConsumedProduct() to finalize the consumption.

Parameters
productThe product to consume.
Returns
true if consuming the product was successful.

◆ ConfirmConsumedProduct()

virtual Bool Murl::IAppStoreControl::ConfirmConsumedProduct ( IAppStoreProduct product)
pure virtual

Confirm consumption of a consumed product.

If a product has the status IAppStoreProduct::STATUS_CONSUMED the consumption of the product must be confirmed. When confirming the consumption, the product status changes to IAppStoreProduct::STATUS_NOT_PURCHASED immediately and the product's receipt data is emptied.

Parameters
productThe product to confirm consumption.
Returns
true if confirm consumption of the product was successful.

◆ TryCancelProduct()

virtual Bool Murl::IAppStoreControl::TryCancelProduct ( IAppStoreProduct product)
pure virtual

Try to cancel an already purchased product.

This method can be used in a test (sandbox) environment to try to cancel a previously purchased product. Note: Currently this only works for the Google Play store when using a test account; on all other platforms this method simply returns false.

Parameters
productThe product to cancel.
Returns
true if cancelling was successful.

◆ GetLastError()

virtual const String& Murl::IAppStoreControl::GetLastError ( ) const
pure virtual

Get the description string of the last error.

Use ClearLastError() to reset the error status.

Returns
The description string of the last error.

◆ ClearLastError()

virtual Bool Murl::IAppStoreControl::ClearLastError ( )
pure virtual

Clear the last error status and string.

Set the connection status IAppStoreProduct::STATUS_ERROR to IAppStoreProduct::STATUS_CONNECTED or IAppStoreProduct::STATUS_IDLE.
Clear the last error string.

Returns
true if successful.

The documentation for this interface was generated from the following file:
  • murl_i_app_store_control.h


Copyright © 2011-2022 Spraylight GmbH.