public class AmazonMonetizationEventBuilder extends MonetizationEventBuilder
// get the event client from your MobileAnalyticsManager instance
EventClient eventClient = mobileAnalyticsManager.getEventClient();
// create a builder that can record purchase events for Amazon IAP
AmazonMonetizationEventBuilder builder = AmazonMonetizationEventBuilder.create(eventClient);
// build the monetization event with the product id, formatted item price, and quantity
// product id and formatted item price are obtained from the Item object
// Amazon IAP currently only supports a quantity of 1
Event purchaseEvent = builder.withProductId(purchasedItem.getSku()).withFormattedItemPrice(purchasedItem.getPrice()).withQuantity(1).build();
// record the monetization event
eventClient.recordEvent(purchaseEvent);
| Modifier and Type | Method and Description |
|---|---|
static AmazonMonetizationEventBuilder |
create(EventClient eventClient)
Create a AmazonMonetizationEventBuilder with the specified Event client
|
AmazonMonetizationEventBuilder |
withFormattedItemPrice(String formattedItemPrice)
Sets the formatted localized price of the item being purchased (accessed from the
getPrice() method of the Item class).
|
AmazonMonetizationEventBuilder |
withProductId(String productId)
Sets the product identifier field of the item being purchased
|
AmazonMonetizationEventBuilder |
withQuantity(Double quantity)
Sets the quantity of the item being purchased.
|
buildpublic static AmazonMonetizationEventBuilder create(EventClient eventClient)
eventClient - The event client to use when creating monetization eventspublic AmazonMonetizationEventBuilder withProductId(String productId)
productId - The product id representing the item being purchasedpublic AmazonMonetizationEventBuilder withFormattedItemPrice(String formattedItemPrice)
formattedItemPrice - The localized formatted price of the itempublic AmazonMonetizationEventBuilder withQuantity(Double quantity)
quantity - Currently, Amazon IAP only supports purchasing 1 item at a
time.Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.