use of com.crashlytics.android.answers.PurchaseEvent in project PhoneProfiles by henrichg.
the class DonationFragment method purchaseSuccessful.
public void purchaseSuccessful(List<Purchase> purchases) {
if (purchases != null) {
for (Purchase purchase : purchases) {
String sku = purchase.getSku();
for (SkuDetails skuDetail : SKU_DETAILS) {
if (skuDetail.getSku().equals(sku)) {
PPApplication.logE(TAG, "purchaseSuccessful - sku=" + sku);
PPApplication.logE(TAG, "purchaseSuccessful - currency=" + skuDetail.getPriceCurrencyCode());
PPApplication.logE(TAG, "purchaseSuccessful - priceS=" + skuDetail.getPrice());
PPApplication.logE(TAG, "purchaseSuccessful - priceMicros=" + skuDetail.getPriceAmountMicros());
PPApplication.logE(TAG, "purchaseSuccessful - price=" + skuDetail.getPriceAmountMicros() / 1000000.0);
Answers.getInstance().logPurchase(new PurchaseEvent().putItemPrice(BigDecimal.valueOf(skuDetail.getPriceAmountMicros() / 1000000.0)).putCurrency(Currency.getInstance(skuDetail.getPriceCurrencyCode())).putItemName("Donation").putItemId(sku).putSuccess(true));
}
}
}
}
if (getActivity() != null) {
PPApplication.setDonationDonated(getActivity().getApplicationContext());
Toast.makeText(getActivity().getApplicationContext(), getString(R.string.donation_thanks_dialog), Toast.LENGTH_LONG).show();
}
}
use of com.crashlytics.android.answers.PurchaseEvent in project PhoneProfilesPlus by henrichg.
the class DonationFragment method purchaseSuccessful.
public void purchaseSuccessful(List<Purchase> purchases) {
if (purchases != null) {
for (Purchase purchase : purchases) {
String sku = purchase.getSku();
for (SkuDetails skuDetail : SKU_DETAILS) {
if (skuDetail.getSku().equals(sku)) {
PPApplication.logE(TAG, "purchaseSuccessful - sku=" + sku);
PPApplication.logE(TAG, "purchaseSuccessful - currency=" + skuDetail.getPriceCurrencyCode());
PPApplication.logE(TAG, "purchaseSuccessful - priceS=" + skuDetail.getPrice());
PPApplication.logE(TAG, "purchaseSuccessful - priceMicros=" + skuDetail.getPriceAmountMicros());
PPApplication.logE(TAG, "purchaseSuccessful - price=" + skuDetail.getPriceAmountMicros() / 1000000.0);
Answers.getInstance().logPurchase(new PurchaseEvent().putItemPrice(BigDecimal.valueOf(skuDetail.getPriceAmountMicros() / 1000000.0)).putCurrency(Currency.getInstance(skuDetail.getPriceCurrencyCode())).putItemName("Donation").putItemId(sku).putSuccess(true));
}
}
}
}
if (getActivity() != null) {
PPApplication.setDonationDonated(getActivity().getApplicationContext());
Toast.makeText(getActivity().getApplicationContext(), getString(R.string.donation_thanks_dialog), Toast.LENGTH_LONG).show();
}
}
use of com.crashlytics.android.answers.PurchaseEvent in project PhoneProfilesPlus by henrichg.
the class DonationFragment method purchaseUnsuccessful.
public void purchaseUnsuccessful(List<Purchase> purchases) {
if (purchases != null) {
for (Purchase purchase : purchases) {
String sku = purchase.getSku();
for (SkuDetails skuDetail : SKU_DETAILS) {
if (skuDetail.getSku().equals(sku)) {
PPApplication.logE(TAG, "purchaseUnsuccessful - sku=" + sku);
PPApplication.logE(TAG, "purchaseUnsuccessful - currency=" + skuDetail.getPriceCurrencyCode());
PPApplication.logE(TAG, "purchaseUnsuccessful - priceS=" + skuDetail.getPrice());
PPApplication.logE(TAG, "purchaseUnsuccessful - priceMicros=" + skuDetail.getPriceAmountMicros());
PPApplication.logE(TAG, "purchaseUnsuccessful - price=" + skuDetail.getPriceAmountMicros() / 1000000.0);
Answers.getInstance().logPurchase(new PurchaseEvent().putItemPrice(BigDecimal.valueOf(skuDetail.getPriceAmountMicros() / 1000000.0)).putCurrency(Currency.getInstance(skuDetail.getPriceCurrencyCode())).putItemName("Donation").putItemId(sku).putSuccess(false));
}
}
}
}
}
use of com.crashlytics.android.answers.PurchaseEvent in project PhoneProfiles by henrichg.
the class DonationFragment method purchaseUnsuccessful.
public void purchaseUnsuccessful(List<Purchase> purchases) {
if (purchases != null) {
for (Purchase purchase : purchases) {
String sku = purchase.getSku();
for (SkuDetails skuDetail : SKU_DETAILS) {
if (skuDetail.getSku().equals(sku)) {
PPApplication.logE(TAG, "purchaseUnsuccessful - sku=" + sku);
PPApplication.logE(TAG, "purchaseUnsuccessful - currency=" + skuDetail.getPriceCurrencyCode());
PPApplication.logE(TAG, "purchaseUnsuccessful - priceS=" + skuDetail.getPrice());
PPApplication.logE(TAG, "purchaseUnsuccessful - priceMicros=" + skuDetail.getPriceAmountMicros());
PPApplication.logE(TAG, "purchaseUnsuccessful - price=" + skuDetail.getPriceAmountMicros() / 1000000.0);
Answers.getInstance().logPurchase(new PurchaseEvent().putItemPrice(BigDecimal.valueOf(skuDetail.getPriceAmountMicros() / 1000000.0)).putCurrency(Currency.getInstance(skuDetail.getPriceCurrencyCode())).putItemName("Donation").putItemId(sku).putSuccess(false));
}
}
}
}
}
Aggregations