| Package | com.milkmangames.nativeextensions.android |
| Class | public class AndroidIAB |
| Inheritance | AndroidIAB flash.events.EventDispatcher |
| Property | Defined By | ||
|---|---|---|---|
| androidIAB : AndroidIAB [static] [read-only]
The current instance of the AndroidIAB singleton. | AndroidIAB | ||
| Method | Defined By | ||
|---|---|---|---|
Do not call this directly. | AndroidIAB | ||
[static]
Initializes the Android Billing Extension. | AndroidIAB | ||
isBillingServiceRunning():Boolean
Checks if Android Market billing service is available and running on the running device. | AndroidIAB | ||
isSupported():Boolean [static]
Checks if the current platform supports the AndroidIAB extension. | AndroidIAB | ||
purchaseItem(itemId:String):void
Sends a request to Android Market to purchase an item with this particular itemID. | AndroidIAB | ||
restoreManagedTransactions():void
Restores Managed transactions for the user. | AndroidIAB | ||
startBillingService(publisherKey:String):void
Starts the billing service, which allows you to make purchases, and listen for changes
in the user's purchase inventory. | AndroidIAB | ||
stopBillingService():void
Completely shutsdown the billing service. | AndroidIAB | ||
testPurchaseItemCancelled():void
Simulates the cancellation of a purchased item, without actually having your app published yet. | AndroidIAB | ||
testPurchaseItemRefunded():void
Simulates the refunding of a purchased item, without actually having your app published yet. | AndroidIAB | ||
testPurchaseItemSuccess():void
Simulates the successful purchase of an item, without actually having your app published yet. | AndroidIAB | ||
testPurchaseItemUnavailable():void
Simulates the attempted purchase of an invalid item id, without actually having your app published yet. | AndroidIAB | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when a purchase has been cancelled (by Google, or by the developer in the control panel) | AndroidIAB | |||
| Dispatched when a purchase attempt fails | AndroidIAB | |||
| Dispatched when a purchase has been refunded (by the developer, in the Market developer control panel) | AndroidIAB | |||
| Dispatched when an item has been successfully purchased | AndroidIAB | |||
| Dispatched when the user cancelled a purchase, by closing the dialog or pressing Back | AndroidIAB | |||
| Dispatched if the billing service will not work on this device | AndroidIAB | |||
| Dispatched when the billing service is ready to use | AndroidIAB | |||
| Dispatched When a Transaction Restore fails | AndroidIAB | |||
| Dispatched when a restore of managed transactions has completed | AndroidIAB | |||
| Constant | Defined By | ||
|---|---|---|---|
| TEST_ITEM_ID_CANCELLED : String = android.test.canceled [static] Special Item ID used for a test of a cancelled item, without actually buying or cancelling anything. | AndroidIAB | ||
| TEST_ITEM_ID_PURCHASED : String = android.test.purchased [static] Special Item ID used for a test of the successful purchase of an item, without actually buying anything. | AndroidIAB | ||
| TEST_ITEM_ID_REFUNDED : String = android.test.refunded [static] Special Item ID used for a test of a refunded item, without actually buying or refunding anything. | AndroidIAB | ||
| TEST_ITEM_ID_UNAVAILABLE : String = android.test.item_unavailable [static] Special Item ID used for a test of an unavailable item, without actually buying anything. | AndroidIAB | ||
| VERSION : String = 1.0.0 [static] Version | AndroidIAB | ||
| androidIAB | property |
androidIAB:AndroidIAB [read-only] The current instance of the AndroidIAB singleton. You must call AndroidIAB.create() before this property is available.
public static function get androidIAB():AndroidIAB| AndroidIAB | () | Constructor |
public function AndroidIAB()Do not call this directly. Use AndroidIAB.create() to Initialize, then you can use AndroidIAB.androidIAB thereafter.
| create | () | method |
public static function create():AndroidIABInitializes the Android Billing Extension. You should check AndroidIAB.isSupported() first to ensure the platform is Android. AndroidIAB is a Singleton and you may have only one instance. After creation, you may access the instance through the static property AndroidIAB.androidIAB .
ReturnsAndroidIAB — initialized instance of AndroidIAB extension interface.
|
Error — if AndroidIAB has already been initialized.
|
| isBillingServiceRunning | () | method |
public function isBillingServiceRunning():BooleanChecks if Android Market billing service is available and running on the running device.
ReturnsBoolean — true if the current device supports Android Market Billing and is running the service.
|
| isSupported | () | method |
public static function isSupported():BooleanChecks if the current platform supports the AndroidIAB extension. Note that this only determines whether the app is running under Android (as opposed to iOS, Windows, etc.), and will NOT tell you whether the particular device has Android Market installed. Use this call before initializing AndroidIAB in order to confirm that you are on Android. (So that you can avoid initializing AndroidIAB on an unsupported platform when building a multi-platform app.) After initialization, you can call AndroidIAB.androidIAB.startBillingService() and wait for the AndroidBillingEvent.SERVICE_READY event to begin making calls. If the particular device can't support the billing service, you'll receive AndroidBillingErrorEvent.SERVICE_NOT_SUPPORTED event instead.
ReturnsBoolean — true if AndroidIAB is supported; false otherwise.
|
| purchaseItem | () | method |
public function purchaseItem(itemId:String):voidSends a request to Android Market to purchase an item with this particular itemID. The item should be declared inside the 'in-app products' section of the Android Market developer panel. After the transaction attempt is complete, you'll receive either an AndroidBillingEvent or an AndroidBillingErrorEvent, depending on the result: AndroidBillingEvent.PURCHASE_SUCCEEDED will be fired if the item was bought successfully. AndroidBillingEvent.PURCHASE_CANCELLED will be fired if the item purchase has been cancelled. AndroidBillingEvent.PURCHASE_REFUNDED will be called if a refund was issued (by you) for the item. AndroidBillingEvent.PURCHASE_USER_CANCELLED will be fired if the user closed the dialog instead of completing the purchase. AndroidBillingErrorEvent.PURCHASE_FAILED will be fired if a network or other error made the purchase fail.
Parameters
itemId:String — the item id, set in your Android Market developer panel, for this item.
|
Error if — the Billing service is not currently running.
|
See also
| restoreManagedTransactions | () | method |
public function restoreManagedTransactions():voidRestores Managed transactions for the user. A 'managed' transaction is an item that the user buys once and then owns forever, such a level pack. When your application runs, you should store a variable in SharedObject or other persistent cache, indicating whether the app has been run before. If it has never been run before, you should call restoreManagedTransactions() to fire events for any managed item the user has already purchased. This way, if the user has uninstalled your app and reinstalled it, or purchased a new device, you can 'give back' everything they've already purchased. You should not call this -every- time the app is run - only when the app appears to have never been ran before on this particular device. After calling restoreManagedTransactions(), you will receive a AndroidBillingEvent for every item the user has purchased in the past; these could be AndroidBillingEvent.PURCHASE_SUCCEEDED, AndroidBillingEvent.PURCHASE_REFUNDED, or AndroidBillingEvent.PURCHASE_CANCELLED. Each event will have an itemId property to tell you which item it refers to. When all the relevant item events have been fired, you'll receive AndroidBillingEvent.TRANSACTIONS_RESTORED.
Error if — the Billing service is not currently running.
|
See also
| startBillingService | () | method |
public function startBillingService(publisherKey:String):voidStarts the billing service, which allows you to make purchases, and listen for changes in the user's purchase inventory. Before calling this, you should be listening for AndroidBillingEvent.SERVICE_READY and AndroidBillingEvent.SERVICE_NOT_SUPPORTED events. When you receive SERVICE_READY, you may begin making purchases and calling the other methods of AndroidIAB. If you receive SERVICE_NOT_SUPPORTED, the device is not capable of handling in-app billing and you will not be able to use it.
Parameters
publisherKey:String — your public key for in-app purchases. You can find this by logging
into your Android Market account, and selecting 'Edit Profile'.
|
Error if — the billing service is already started.
|
See also
| stopBillingService | () | method |
public function stopBillingService():voidCompletely shutsdown the billing service. You can call this to completely stop receiving notifications of billing state changes.
Error if — the billing service is not running or has already been stopped.
|
| testPurchaseItemCancelled | () | method |
public function testPurchaseItemCancelled():voidSimulates the cancellation of a purchased item, without actually having your app published yet. After the purchase UI is completed, you'll receive the AndroidBillingEvent.PURCHASE_CANCELLED event. This is useful for testing your code, without actually having published your application yet, or having to make a purchase with real money for testing.
Error if — the Billing service is not currently running.
|
See also
| testPurchaseItemRefunded | () | method |
public function testPurchaseItemRefunded():voidSimulates the refunding of a purchased item, without actually having your app published yet. After the purchase UI is completed, you'll receive the AndroidBillingEvent.PURCHASE_REFUNDED event. This is useful for testing your code, without actually having published your application yet, or having to make a purchase with real money for testing.
Error if — the Billing service is not currently running.
|
See also
| testPurchaseItemSuccess | () | method |
public function testPurchaseItemSuccess():voidSimulates the successful purchase of an item, without actually having your app published yet. After the purchase UI is completed, you'll receive the AndroidBillingEvent.PURCHASE_SUCCEEDED event. This is useful for testing your code, without actually having published your application yet, or having to make a purchase with real money for testing.
Error if — the Billing service is not currently running.
|
See also
| testPurchaseItemUnavailable | () | method |
public function testPurchaseItemUnavailable():voidSimulates the attempted purchase of an invalid item id, without actually having your app published yet. After the purchase UI is completed, you'll receive the AndroidBillingErrorEvent.PURCHASE_FAILED event. This is useful for testing your code, without actually having published your application yet, or having to make a purchase with real money for testing.
Error if — the Billing service is not currently running.
|
See also
| PURCHASE_CANCELLED | Event |
com.milkmangames.nativeextensions.android.events.AndroidBillingEventDispatched when a purchase has been cancelled (by Google, or by the developer in the control panel)
| PURCHASE_FAILED | Event |
com.milkmangames.nativeextensions.android.events.AndroidBillingErrorEventDispatched when a purchase attempt fails
| PURCHASE_REFUNDED | Event |
com.milkmangames.nativeextensions.android.events.AndroidBillingEventDispatched when a purchase has been refunded (by the developer, in the Market developer control panel)
| PURCHASE_SUCCEEDED | Event |
com.milkmangames.nativeextensions.android.events.AndroidBillingEventDispatched when an item has been successfully purchased
| PURCHASE_USER_CANCELLED | Event |
com.milkmangames.nativeextensions.android.events.AndroidBillingEventDispatched when the user cancelled a purchase, by closing the dialog or pressing Back
| SERVICE_NOT_SUPPORTED | Event |
com.milkmangames.nativeextensions.android.events.AndroidBillingEventDispatched if the billing service will not work on this device
| SERVICE_READY | Event |
com.milkmangames.nativeextensions.android.events.AndroidBillingEventDispatched when the billing service is ready to use
| TRANSACTION_RESTORE_FAILED | Event |
com.milkmangames.nativeextensions.android.events.AndroidBillingErrorEventDispatched When a Transaction Restore fails
| TRANSACTIONS_RESTORED | Event |
com.milkmangames.nativeextensions.android.events.AndroidBillingEventDispatched when a restore of managed transactions has completed
| TEST_ITEM_ID_CANCELLED | Constant |
public static const TEST_ITEM_ID_CANCELLED:String = android.test.canceledSpecial Item ID used for a test of a cancelled item, without actually buying or cancelling anything. After calling testPurchaseItemCancelled(), the AndroidBillingEvent fired will include this as the .itemID property.
See also
| TEST_ITEM_ID_PURCHASED | Constant |
public static const TEST_ITEM_ID_PURCHASED:String = android.test.purchasedSpecial Item ID used for a test of the successful purchase of an item, without actually buying anything. After calling testPurchaseItemSuccess(), the AndroidBillingEvent fired will include this as the .itemID property.
See also
| TEST_ITEM_ID_REFUNDED | Constant |
public static const TEST_ITEM_ID_REFUNDED:String = android.test.refundedSpecial Item ID used for a test of a refunded item, without actually buying or refunding anything. After calling testPurchaseItemRefunded(), the AndroidBillingEvent fired will include this as the .itemID property.
See also
| TEST_ITEM_ID_UNAVAILABLE | Constant |
public static const TEST_ITEM_ID_UNAVAILABLE:String = android.test.item_unavailableSpecial Item ID used for a test of an unavailable item, without actually buying anything. 'Unavailable' means the itemID doesn't exist in your Android Market Publisher control panel. After calling testPurchaseItemUnavailable(), the AndroidBillingEvent fired will include this as the .itemID property.
See also
| VERSION | Constant |
public static const VERSION:String = 1.0.0Version