facebook-android-sdk icon indicating copy to clipboard operation
facebook-android-sdk copied to clipboard

Implict purchase tracking doesn't work when using Google Play Billing Library

Open samruston opened this issue 6 years ago • 19 comments

Checklist

Environment

Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:

  • Java Version: 1.8
  • Android SDK Version: 29
  • Installation Platform & Verison: Gradle version 5.6.4

Goals

Implicit purchase tracking events should be sent when a purchase happens inside an Android app.

Expected Results

What do you expect to happen?

Actual Results

They aren't sent when using the Google Play Billing Library instead of AIDL.

From InAppPurchaseActivityLifecycleTracker.java

    private static final String SERVICE_INTERFACE_NAME =
            "com.android.vending.billing.IInAppBillingService$Stub";
....
        try {
            Class.forName(SERVICE_INTERFACE_NAME);
            hasBillingService = true;
        } catch (ClassNotFoundException ignored) {
            hasBillingService = false;
            return;
        }

The ClassNotFoundException gets thrown and so InAppPurchaseActivityLifecycleTracker never initializes.

A temporary workaround is to manually include the AIDL file so it's available to the Facebook SDK.

samruston avatar May 19 '20 12:05 samruston

Thanks for reporting it. It's very valuable to us. Seems like there is a change in Google Play Billing service for V2+ and current Facebook SDK does not support it. This feature is critical and we will make the change within next a few major releases.

Thanks again!

YOUDAN avatar May 27 '20 19:05 YOUDAN

Any update on that? thanks in advance

nes123 avatar Aug 06 '20 19:08 nes123

@YOUDAN any update?

spacen avatar Oct 07 '20 12:10 spacen

@YOUDAN any planned updates about this issue? Or at least it's a good idea to add some note in docs that it won't work with newer versions of Billing Library.

ivanz5 avatar Oct 28 '20 11:10 ivanz5

No updates yet?

hex avatar Jan 13 '21 10:01 hex

@YOUDAN is there anything new? I'm stuck, I can't receive any App-In purchase events while using V3 google pay and the facebook android sdk version is 9.0.0. Thanks in advance.

evanforest avatar Mar 03 '21 02:03 evanforest

I have been tracking down all the documentations to find why purchases are not being logged. Tried to debug the code by looking at the source and finally found myself here.

I am totally amazed about this. One of the biggest companies in the world selling ads still has no support for v3 google play billing library while the other ways are being deprecated.

The worst part is there is no such warning in any of the documentations about the issue. I totally appreciate it.

mrtcnnccn avatar Mar 10 '21 15:03 mrtcnnccn

@mrtcnnccn, it looks like v11, released a couple days ago adds support for v3 Google play billing. Change log here

taacton avatar Jun 11 '21 10:06 taacton

@mrtcnnccn, it looks like v11, released a couple days ago adds support for v3 Google play billing. Change log here

Thanks for that. Has anybody checked it? Is it working correct?

Edit: FeatureManager.Feature.IapLogging and FeatureManager.Feature.IapLoggingLib2 are not getting enabled automatically so tracking is not starting. Anybody tested it?

FetchedAppGateKeepersManager.loadAppGateKeepersAsync(object: FetchedAppGateKeepersManager.Callback{ override fun onCompleted() { FetchedAppGateKeepersManager.setRuntimeGateKeeper(RemoteConfigParams.getFBApplicationId(), GateKeeper("FBSDKFeatureIAPLogging", true)) FetchedAppGateKeepersManager.setRuntimeGateKeeper(RemoteConfigParams.getFBApplicationId(), GateKeeper("FBSDKFeatureIAPLoggingLib2", true)) FacebookSdk.setAutoLogAppEventsEnabled(true) } }) Looks like those features are closed remotely by Facebook. However, this code enables tracking 'purchases' for billing v2plus.

Note: As I see from the source code tracking is only enabled for purchases not for subscriptions. See line:47 and line 56 here: https://github.com/facebook/facebook-android-sdk/blob/0fbbf807c0715bf3c8e52ab57b2e710ba76397fe/facebook-core/src/main/java/com/facebook/appevents/iap/InAppPurchaseAutoLogger.java

mrtcnnccn avatar Jun 11 '21 16:06 mrtcnnccn

  • Both FBSDKFeatureIAPLogging & FBSDKFeatureIAPLoggingLib2 FG is always return false
  • InAppPurchaseAutoLogger.java impl for Google Play Billing V2/V3 Only Support PURCHASE NOT SUBSCRIBE

FUNNY 11.0.0 CHANGE LOG, WASTE TIME

ztdr avatar Jun 30 '21 10:06 ztdr

Still having this issue, extremely frustrating that there has been zero communication around this, as it's a pretty crucial part of the Facebook Ads platform.

LukevanTricht avatar Aug 18 '21 06:08 LukevanTricht

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 17 '21 05:11 github-actions[bot]

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

It still desperately needs attention

LukevanTricht avatar Nov 17 '21 08:11 LukevanTricht

According the changelog (https://github.com/facebook/facebook-android-sdk/blob/main/CHANGELOG.md), 11.0.0 is supposed to support auto logging of Google billing v2/v3 purchases. However this feature is still default to off in the SDK and cannot be changed. Any updates from the team?

Expanded support for auto-logging of in-app purchases to support apps that use V2 and/or V3 of the Google Play Billing Library

UPDATE: I noticed that the feature switch "FBSDKFeatureIAPLoggingLib2" was set to false when graph API mobile_sdk_gk is called with user agent set to FBAndroidSDK.11.x.x. This has caused the SDK to not run auto logging for Google Play Billing v2/v3. The API returns true for the same switch value when a different user agent string is used.

If this is by-design, you should at least update the documentation.

gnoph avatar Feb 03 '22 03:02 gnoph

Repro for FBSDKFeatureIAPLoggingLib2 feature switch issue (replace token with a valid applicationId)

curl "https://graph.facebook.com/v11.0/<APPID>/mobile_sdk_gk?fields=gatekeepers&format=json&sdk_version=11.3.0&sdk=android&platform=android" -H "ContentType: application/x-www-form-urlencoded" -H "User-Agent: FBAndroidSDK.11.3.0"

gnoph avatar Feb 03 '22 11:02 gnoph

Are there any updates?

henry-dreamo avatar Mar 30 '22 12:03 henry-dreamo

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jun 29 '22 05:06 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

github-actions[bot] avatar Jul 06 '22 05:07 github-actions[bot]

Any more information about this?

LukevanTricht avatar Jan 27 '23 06:01 LukevanTricht