public class AmazonMonetizationEventBuilder extends MonetizationEventBuilder
// create a builder that can record purchase events for Amazon IAP
AmazonMonetizationEventBuilder builder = AmazonMonetizationEventBuilder.create(pinpointManager.getAnalyticsClient());
// 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
pinpointManager.getAnalyticsClient().recordEvent(purchaseEvent);
| Modifier | Constructor and Description |
|---|---|
protected |
AmazonMonetizationEventBuilder(AnalyticsClient analyticsClient)
Construct a AmazonMonetizationEventBuilder with the specified EventClient
|
| Modifier and Type | Method and Description |
|---|---|
static AmazonMonetizationEventBuilder |
create(AnalyticsClient analyticsClient)
Create a AmazonMonetizationEventBuilder with the specified Event client
|
protected boolean |
isValid()
Determines if all builder methods on this builder have been called
|
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.
|
build, getCurrency, getFormattedItemPrice, getItemPrice, getProductId, getQuantity, getStore, getTransactionId, setCurrency, setFormattedItemPrice, setItemPrice, setProductId, setQuantity, setStore, setTransactionIdprotected AmazonMonetizationEventBuilder(AnalyticsClient analyticsClient)
analyticsClient - The EventClient to use when building the eventpublic static AmazonMonetizationEventBuilder create(AnalyticsClient analyticsClient)
analyticsClient - 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.protected boolean isValid()
MonetizationEventBuilderisValid in class MonetizationEventBuilderCopyright © 2016. All rights reserved.