com.amazonaws.mobileconnectors.amazonmobileanalytics.monetization
Class VirtualMonetizationEventBuilder

java.lang.Object
  extended by com.amazonaws.mobileconnectors.amazonmobileanalytics.monetization.MonetizationEventBuilder
      extended by com.amazonaws.mobileconnectors.amazonmobileanalytics.monetization.VirtualMonetizationEventBuilder

public class VirtualMonetizationEventBuilder
extends MonetizationEventBuilder

Builds monetization events representing a purchase from a Virtual or In-Game store. This Builder automatically sets the store attribute to "Virtual". This Builder will return null if the ProductId, Price, Currency, or Quantity are not set.

The example below shows how to record a monetization event for the purchase of 1 sword that costs 500 Gold.

Example:
    // get the event client from your MobileAnalyticsManager instance
    EventClient eventClient = mobileAnalyticsManager.getEventClient();
    
    // create a builder that can record purchase events for a Virtual In Game Store
    VirtualMonetizationEventBuilder builder = VirtualMonetizationEventBuilder.create(eventClient);
    
    // build the monetization event with the product id, item price, currency type, and quantity
    Event purchaseEvent = builder.withProductId("com.yourgame.sword").withItemPrice(500).withCurrency("Gold").withQuantity(1).build();
    
    // record the monetization event
    eventClient.recordEvent(purchaseEvent);
 


Method Summary
static VirtualMonetizationEventBuilder create(EventClient eventClient)
          Create a VirtualMonetizationEventBuilder with the specified Event client
 VirtualMonetizationEventBuilder withCurrency(java.lang.String currency)
          Sets the currency of the item being purchased.
 VirtualMonetizationEventBuilder withItemPrice(double itemPrice)
          Sets the numerical price of the item being purchased
 VirtualMonetizationEventBuilder withProductId(java.lang.String productId)
          Sets the product identifier field of the item being purchased.
 VirtualMonetizationEventBuilder withQuantity(java.lang.Double quantity)
          Sets the quantity of the item being purchased.
 
Methods inherited from class com.amazonaws.mobileconnectors.amazonmobileanalytics.monetization.MonetizationEventBuilder
build
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static VirtualMonetizationEventBuilder create(EventClient eventClient)
Create a VirtualMonetizationEventBuilder with the specified Event client

Parameters:
eventClient - The event client to use when creating monetization events
Returns:
a VirtualMonetizationEventBuilder to build monetization events from a Virtual Store

withProductId

public VirtualMonetizationEventBuilder withProductId(java.lang.String productId)
Sets the product identifier field of the item being purchased.

Parameters:
productId - The product id representing the item being purchased
Returns:
this for chaining

withItemPrice

public VirtualMonetizationEventBuilder withItemPrice(double itemPrice)
Sets the numerical price of the item being purchased

Parameters:
itemPrice - The numerical price of the item
Returns:
this for chaining

withQuantity

public VirtualMonetizationEventBuilder withQuantity(java.lang.Double quantity)
Sets the quantity of the item being purchased.

Parameters:
quantity - The number of items purchased in this transaction
Returns:
this for chaining

withCurrency

public VirtualMonetizationEventBuilder withCurrency(java.lang.String currency)
Sets the currency of the item being purchased.

Parameters:
currency - The name of the virtual currency used to purchase this item (i.e. Coins or Gold)
Returns:
this for chaining


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.