0

I am having an issue with AppsFlyer Android SDK AppsFlyerInAppPurchaseValidatorListener class.

AppsFlyerLib.getInstance().registerValidatorListener(this,new
   AppsFlyerInAppPurchaseValidatorListener() {
     public void onValidateInApp() {
       Log.d(TAG, "Purchase validated successfully");
     }
     public void onValidateInAppFailure(String error) {
       Log.d(TAG, "onValidateInAppFailure called: " + error);
     }
});

Currently there is no way to detect which particular purchase transaction was successful with this listener. So for example, if I am validating multiple purchase transactions from a Google Billing Client queryPurchasesAsync call. This listener will not tell me which specific purchase transaction was successful or failed.

The closest solution to this that I found was at:

AppsFlyerAndroidWrapper.java

public static void validateAndTrackInAppPurchase (String publicKey, String signature, String            purchaseData, String price, String currency, HashMap<String, String> additionalParameters, String objectName) 
{
        AppsFlyerLib.getInstance().validateAndLogInAppPurchase(UnityPlayer.currentActivity,   
        publicKey, signature, purchaseData, price, currency, additionalParameters);

        if (objectName != null)
        {
            initInAppPurchaseValidatorListener(objectName);
        }
}

public static void initInAppPurchaseValidatorListener(final String objectName) 
{
        AppsFlyerLib.getInstance().registerValidatorListener(UnityPlayer.currentActivity, new 
           AppsFlyerInAppPurchaseValidatorListener() 
           {
               @Override
               public void onValidateInApp() {
                if(objectName != null){
                    UnityPlayer.UnitySendMessage(objectName, VALIDATE_CALLBACK, "Validate 
                    success");
                }
            }

            @Override
            public void onValidateInAppFailure(String error) {
                if(objectName != null){
                    UnityPlayer.UnitySendMessage(objectName, VALIDATE_ERROR_CALLBACK, error);
                }
            }
        });
    }

Here it looks like they instantiate a new validator listener for each call to validateAndLogInAppPurchase. However, will that not just get rid of the previous validator listener that was instantiated? To me it looks like you can only register ONE validator listener at a time with AppsFlyer. There is no way to tie a particular validator listener to a specific validateAndLogInAppPurchase call. I've searched high and low and have not been able to find a definitive answer to this question so any pointers anyone has would be greatly appreciated.

Thanks

I have searched through github, the Appsflyer Android SDK samples and this particular situation is never addressed. In particular there are no Android SDK samples that tackle this issue so it may be that support for multiple transaction validations is not supported by the Appsflyer Android SDK.

vspyder
  • 31
  • 4

0 Answers0