Search in sources :

Example 1 with BillingSkuDetails

use of com.litekite.inappbilling.room.entity.BillingSkuDetails in project Android-InAppBilling by LiteKite.

the class BillingManager method storeSkuDetailsLocally.

/**
 * Stores SKU Details on local storage.
 *
 * @param skuDetailsList list of SKU Details returned from the queries.
 */
private void storeSkuDetailsLocally(List<SkuDetails> skuDetailsList) {
    final List<BillingSkuDetails> billingSkuDetailsList = new ArrayList<>();
    for (SkuDetails skuDetails : skuDetailsList) {
        BillingSkuDetails billingSkuDetails = new BillingSkuDetails();
        billingSkuDetails.skuID = skuDetails.getSku();
        billingSkuDetails.skuType = skuDetails.getType();
        billingSkuDetails.skuPrice = skuDetails.getPrice();
        billingSkuDetailsList.add(billingSkuDetails);
    }
    new Thread(new Runnable() {

        @Override
        public void run() {
            AppDatabase.getAppDatabase(context).getBillingDao().insertSkuDetails(billingSkuDetailsList);
        }
    }).start();
}
Also used : BillingSkuDetails(com.litekite.inappbilling.room.entity.BillingSkuDetails) SkuDetails(com.android.billingclient.api.SkuDetails) ArrayList(java.util.ArrayList) BillingSkuDetails(com.litekite.inappbilling.room.entity.BillingSkuDetails)

Aggregations

SkuDetails (com.android.billingclient.api.SkuDetails)1 BillingSkuDetails (com.litekite.inappbilling.room.entity.BillingSkuDetails)1 ArrayList (java.util.ArrayList)1