Event tracking does not work in web view.
I applied the adjust event to the webview. However, I cannot check the test console. The following error appears when the page is over.
E / Adjust: Application context missing. Call AdjustBridge.setApplicationContext before
Why is the event checking not related to the above log?
Hi @jsungh88
Sorry for a bit delayed answer. Did you complete all the steps from README when it comes to setting up bridge in native part of your app?
Hi again, I suppose I has found couple bugs related to this question in AdjustBridge for android. Most issues id related to re-creation of Activity, like rotation or second start of the same activity.
- There is an memory leak in AdjustBridgeInstance. You hold the webview link for the all time, and never release it. It's completely wrong. In your case Activity cannot be destoyed after user closes it. And there is no way to release webview reference from AdjustBridgeInstance.
- The method registerAndGetInstance() from AdjustBridge works fine only for the first time. After second call of it the webview is not changed, as we have an instance of AdjustBridgeInstance. It's ok, and we have setWebView() to changed it, but it has a bug. AdjustBridgeInstance.setWebView() does not attach JS Interface to new webview, so any code from html/js part won't work correctly after this call.
How to reproduce these issues:
- Use AdjustBridge in any way as said in documentation.
- Close Activity and start it again (or just rotate activity - it will be recreated).
- Check results.
@evgentset
Thanks for these findings and detailed explanations, really useful! We'll check this out and redo the bridge in accordance to your advices. Hopefully this will be part of next SDK update. Will keep you posted!
Thank you, I was happy to help.
Actually, the issue more complicated. For example, It may be reproduced in cases when user have 2 different WebView, like 2 fragments with WebViews and so on.
I think to fix this issue you need to provide possibility to chnage webview somehow (and set it to null). Or even better, you can save array of WebViews and release them in proper time (onStop or onDestroy maybe). Anyway, It's up to you how to fix it.
@uerceg Any news on this?
Would be great if a fix for the issues pointed out by @evgentset could land in the next release. I burned a complete day debugging why my app was not tracking correctly just to figure out that this is a bug in the Adjust SDK.
Adding the bridge only works once. So if there is more than one web view or if the web view needs to be recreated there is no tracking at all and the javascript ends up with an error because of the missing AdjustBridge object.
Hey @Phobetor
Sorry for delay on our end, we'll be adding fix for this in upcoming bridge updates. Will keep you posted.
Hello @uerceg
Great to hear that. Thanks!
Hey guys,
Today we released v4.22.0 update where we tried to address this issue.
Please give it a shot and let us know if it worked for you. We have extended bridge API and also updated README instructions a bit, so make sure to check those as well.
Looking forward to hearing back from you.
Cheers
In case issue still persists, feel free to reopen/comment.