diff --git a/README.md b/README.md index 258809c..a473e44 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,12 @@ private val billingManager by lazy { BillingManager(context) } ### Step # 2 (Billing Connection) -Retrieve a debugging ID for testing purposes by utilizing the `debugProductId` method. Ensure that the parameter `purchaseDetailList` represents a list containing all active purchases along with their respective details. +Retrieve a debugging ID for testing purposes by utilizing the `getDebugProductIDList()` method. Ensure that the parameter `purchaseDetailList` represents a list containing all active purchases along with their respective details. ``` val subsProductIdList = listOf("subs_product_id_1", "subs_product_id_2", "subs_product_id_3") val inAppProductIdList = when (BuildConfig.DEBUG) { - true -> listOf(billingManager.debugProductId) + true -> listOf(billingManager.getDebugProductIDList()) false -> listOf("inapp_product_id_1", "inapp_product_id_2") } @@ -110,7 +110,7 @@ This observer monitors all active in-app and subscription products. val subsProductIdList = listOf("subs_product_id_1", "subs_product_id_2", "subs_product_id_3") val subsPlanIdList = listOf("subs_plan_id_1", "subs_plan_id_2", "subs_plan_id_3") -billingManager.observeQueryProducts().observe(viewLifecycleOwner) { productDetailList -> +billingManager.productDetailsLiveData.observe(viewLifecycleOwner) { productDetailList -> Log.d(TAG, "Billing: initObservers: $productDetailList") productDetailList.forEach { productDetail -> diff --git a/app/build.gradle b/app/build.gradle index 78823ec..790b081 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,6 +28,9 @@ android { kotlinOptions { jvmTarget = '17' } + buildFeatures{ + buildConfig true + } } dependencies { diff --git a/app/src/main/java/com/hypersoft/inappbilling/MainActivity.kt b/app/src/main/java/com/hypersoft/inappbilling/MainActivity.kt index f025014..4bac8a1 100644 --- a/app/src/main/java/com/hypersoft/inappbilling/MainActivity.kt +++ b/app/src/main/java/com/hypersoft/inappbilling/MainActivity.kt @@ -3,18 +3,12 @@ package com.hypersoft.inappbilling import android.os.Bundle import android.util.Log import android.widget.Button -import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import com.hypersoft.billing.BillingManager -import com.hypersoft.billing.common.interfaces.OnPurchaseListener -import com.hypersoft.billing.latest.dataClasses.PurchaseDetail -import com.hypersoft.billing.latest.interfaces.BillingListener -import com.hypersoft.billing.oldest.constants.SubscriptionPlans -import com.hypersoft.billing.oldest.constants.SubscriptionProductIds -import com.hypersoft.billing.oldest.dataClasses.ProductDetail -import com.hypersoft.billing.oldest.interfaces.OnConnectionListener -import com.hypersoft.billing.oldest.status.State +import com.hypersoft.billing.dataClasses.PurchaseDetail +import com.hypersoft.billing.interfaces.BillingListener +import com.hypersoft.billing.interfaces.OnPurchaseListener const val TAG = "MyTag" @@ -22,16 +16,14 @@ class MainActivity : AppCompatActivity() { private val billingManager by lazy { BillingManager(this) } - // Old way - private lateinit var tvTitle: TextView - private val productId: String = "Paste your original Product ID" - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - newWay() - oldWay() + initBilling() + initObserver() + + findViewById