appsflyer-android-app icon indicating copy to clipboard operation
appsflyer-android-app copied to clipboard

AppsFlyerConversionListener not triggered.

Open raman-branavitski opened this issue 4 years ago • 7 comments

Hi, found an issue. According to documentation startTracking can be postponed until you receive user consent due to GDPR or CCPA requirements, etc.(https://support.appsflyer.com/hc/en-us/articles/207032126-Android-SDK-integration-for-developers#integration-34-delaying-initializing-the-sdk)

In case of startTracking will be called with Application context after MainActivity.onResume() AppsFlyerConversionListener wouldn't be called until activity's onResume() will be triggered again.

raman-branavitski avatar Aug 06 '20 06:08 raman-branavitski

Hey @raman-branavitski!

As mentioned in the doc you refer to, please make sure to pass Activity instance as a context argument and not Application.

sokoloff06 avatar Aug 06 '20 07:08 sokoloff06

Yes, that's a problem. In documentation there isn't any information that I should pass Activity context. Otherwise conversationListener doesn't work.

raman-branavitski avatar Aug 06 '20 07:08 raman-branavitski

@raman-branavitski here is the section with the relevant instructions. Please let us know if anything is yet not clear image

sokoloff06 avatar Aug 06 '20 07:08 sokoloff06

Ok, thanks. The problem is that I don't call startTracking() inside Activity class. We have AppsFlyerManager class which encapsulate all logic with Appsflyer integration. This class initialized inside Application class with it's context(Application context). Also AppsFlyerManager starts listen GDPR status(accepted or not) and when user accept GDPR it call startTracking with Application context(at this moment activity's onResume() is already passed).

raman-branavitski avatar Aug 06 '20 07:08 raman-branavitski

To summarize. I can call startTracking() with application context only right after init(). If startTracking() should be postponed I should call it with ONLY Activity context. Right?

raman-branavitski avatar Aug 06 '20 07:08 raman-branavitski

@raman-branavitski Thanks for elaborating, understand the challenge more clearly now. You are correct, to make sure late initialization is done properly, you should pass Activity class as the context argument. The reason behind that is that our SDK needs to inspect Activity's intent to see if it contains any deep link data. In fact, I get your point and will check internally if we can improve in this area or give you some other solution

sokoloff06 avatar Aug 06 '20 08:08 sokoloff06

Thanks Vitaly

raman-branavitski avatar Aug 06 '20 08:08 raman-branavitski