facebook-android-sdk
facebook-android-sdk copied to clipboard
SDK 16.0.1 not working fully with Billing Client 5.0 - In-app purchase events are not sent.
Checklist before submitting a bug report
- [X] I've updated to the latest released version of the SDK
- [X] I've searched for existing Github issues
- [X] I've looked for existing answers on Stack Overflow, the Facebook Developer Community Forum and the Facebook Developers Group
- [X] I've read the Code of Conduct
- [X] This issue is not security related and can safely be disclosed publicly on GitHub
Java version
1.8
Android version
13
Android SDK version
33
Installation platform & version
Gradle plugin 7.4.x
Package
Other / I don't know
Goals
Upate billing client to 5.0 or 5.1 in Facebook SDK to send properly In-app purchase events to Meta analytics console.
Expected results
In our project we already use Google Billing Client with version 5.0. This billing client is suggested in Google Play developer console. (Should be always updated)
I want to use latest Facebook SDK with this client, but currently Facebook SDK use version 3.0.0 that can connect to Billing client in version 5.0 because of class missing.
We can't revert billing client to 4.0 because of already implemented migration from Billing client 4.0 to 5.0.
Actual results
In Facebool SDK Google client wrapper is missing class: com.android.billingclient.api.Purchase$PurchasesResult
This class exist in billing 3.x an 4.x but on billingclient.api.Purchase in 5.0 version this is changed. Because of that Facebook SDK can't create instance of InAppPurchaseBillingClientWrapper. When constructor create instance, try to find class by name com.android.billingclient.api.Purchase$PurchasesResult and this class is missing. So wrapper is created, but instance is null.
Result of that is that SDK can't query purchases and send it automatically as events to Facebook platform.
Steps to reproduce
Use Google billing client in version 5.0 and Facebook SDK in version 16.0.1 Make in-app purchase and see that no events are sent. No add to cart event and no purchase event.
Code samples & details
fun getOrCreateInstance(context: Context): InAppPurchaseBillingClientWrapper? {
if (initialized.get()) {
return instance
}
createInstance(context)
initialized.set(true)
return instance
}
private fun createInstance(context: Context) {
val inAppPurchaseSkuDetailsWrapper = getOrCreateInstance() ?: return
val billingClientClazz = getClass(CLASSNAME_BILLING_CLIENT)
val purchaseClazz = getClass(CLASSNAME_PURCHASE)
val purchaseResultClazz = getClass(CLASSNAME_PURCHASES_RESULT)
val skuDetailsClazz = getClass(CLASSNAME_SKU_DETAILS)
val purchaseHistoryRecordClazz = getClass(CLASSNAME_PURCHASE_HISTORY_RECORD)
val skuDetailsResponseListenerClazz = getClass(CLASSNAME_SKU_DETAILS_RESPONSE_LISTENER)
val purchaseHistoryResponseListenerClazz =
getClass(CLASSNAME_PURCHASE_HISTORY_RESPONSE_LISTENER)
if (billingClientClazz == null ||
purchaseResultClazz == null ||
purchaseClazz == null ||
skuDetailsClazz == null ||
skuDetailsResponseListenerClazz == null ||
purchaseHistoryRecordClazz == null ||
purchaseHistoryResponseListenerClazz == null) {
return
}
val queryPurchasesMethod =
getMethod(billingClientClazz, METHOD_QUERY_PURCHASES, String::class.java)
val getPurchaseListMethod = getMethod(purchaseResultClazz, METHOD_GET_PURCHASE_LIST)
val getOriginalJsonMethod = getMethod(purchaseClazz, METHOD_GET_ORIGINAL_JSON)
val getOriginalJsonSkuMethod = getMethod(skuDetailsClazz, METHOD_GET_ORIGINAL_JSON)
val getOriginalJsonPurchaseHistoryMethod =
getMethod(purchaseHistoryRecordClazz, METHOD_GET_ORIGINAL_JSON)
val querySkuDetailsAsyncMethod =
getMethod(
billingClientClazz,
METHOD_QUERY_SKU_DETAILS_ASYNC,
inAppPurchaseSkuDetailsWrapper.skuDetailsParamsClazz,
skuDetailsResponseListenerClazz)
val queryPurchaseHistoryAsyncMethod =
getMethod(
billingClientClazz,
METHOD_QUERY_PURCHASE_HISTORY_ASYNC,
String::class.java,
purchaseHistoryResponseListenerClazz)
if (queryPurchasesMethod == null ||
getPurchaseListMethod == null ||
getOriginalJsonMethod == null ||
getOriginalJsonSkuMethod == null ||
getOriginalJsonPurchaseHistoryMethod == null ||
querySkuDetailsAsyncMethod == null ||
queryPurchaseHistoryAsyncMethod == null) {
return
}
Missing class is
private const val CLASSNAME_PURCHASES_RESULT =
"com.android.billingclient.api.Purchase\$PurchasesResult"
Please update it
we experience the same issue
+1
+1
'com.facebook.android:facebook-android-sdk:16.2.0' 'com.android.billingclient:billing:6.0.1'
我在使用上面的版本SDK也是无法收到In-app purchase的事件记录,只能收到安装和启动的事件记录。
me too implementation 'com.facebook.android:facebook-android-sdk:latest.release' implementation("com.android.billingclient:billing:6.0.1")
don't full work . no log iap event.
'com.facebook.android:facebook-android-sdk:16.2.0' 'com.android.billingclient:billing:6.0.1'
我在使用上面的版本SDK也是无法收到In-app purchase的事件记录,只能收到安装和启动的事件记录。 所以请问,你最近解决这个问题了吗?求助
'com.facebook.android:facebook-android-sdk:16.0.0'
'com.android.billingclient:billing:6.1.0'
in-app-purchase event not triggered. other events(install, custom events) triggers.
When I researched in detail;
Google Play Billing Library version 3.0.0 appears in facebook-android-sdk. However, google has declared the following regarding the billing version.
- Starting on August 2, 2023, all new apps must use Billing Library version 5 or newer. By November 1, 2023, all updates to existing apps must use Billing Library version 5 or newer
- If your app is targeting Android 14 or higher, you must update to PBL 5.2.1 or PBL 6.0.1 or higher. So, active-updated apps use minimum v5. There are no more apps using v3.
How can facebook-android-sdk still use v3? How can it be so outdated?
Same trouble - no purchase events. Is there any solution?