Search in sources :

Example 1 with PurchaseEvent

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();
    }
}
Also used : SkuDetails(com.android.billingclient.api.SkuDetails) PurchaseEvent(com.crashlytics.android.answers.PurchaseEvent) Purchase(com.android.billingclient.api.Purchase)

Example 2 with PurchaseEvent

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();
    }
}
Also used : SkuDetails(com.android.billingclient.api.SkuDetails) PurchaseEvent(com.crashlytics.android.answers.PurchaseEvent) Purchase(com.android.billingclient.api.Purchase)

Example 3 with PurchaseEvent

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));
                }
            }
        }
    }
}
Also used : SkuDetails(com.android.billingclient.api.SkuDetails) PurchaseEvent(com.crashlytics.android.answers.PurchaseEvent) Purchase(com.android.billingclient.api.Purchase)

Example 4 with PurchaseEvent

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));
                }
            }
        }
    }
}
Also used : SkuDetails(com.android.billingclient.api.SkuDetails) PurchaseEvent(com.crashlytics.android.answers.PurchaseEvent) Purchase(com.android.billingclient.api.Purchase)

Aggregations

Purchase (com.android.billingclient.api.Purchase)4 SkuDetails (com.android.billingclient.api.SkuDetails)4 PurchaseEvent (com.crashlytics.android.answers.PurchaseEvent)4