dusanmiha

Facebook App - Ecommerce - Android - Java - Purchased Event

Oct 14th, 2021
538
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * This function assumes logger is an instance of AppEventsLogger and has been
  3.  * created using AppEventsLogger.newLogger() call.
  4.  */
  5. public void logPurchasedEvent (int numItems, String contentType, String contentId, String currency, double price) {
  6.     Bundle params = new Bundle();
  7.     params.putInt(AppEventsConstants.EVENT_PARAM_NUM_ITEMS, numItems);                  //Number of items. Integer.
  8.     params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, contentType);         //'product' or 'product_group'. String.
  9.     params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, contentId);             //product identifier. String.
  10.     params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, currency);                //ISO 4217 code, e.g., "EUR", "RSD"..string.
  11.     logger.logPurchase(price, Currency.getInstance(currency),params);
  12. }
RAW Paste Data