Closed AlanChiou closed 2 years ago
@AlanChiou Thank you for your feedback. As you pointed out, WebView leaks are likely to occur in that situation.
We will accept your proposal. After fix, we will release it. Please wait for a while.
@wasnot Could you check if the using WebView is released properly when the user closes the app as well?
@AlanChiou Sorry for the late reply.
Does "closes the app" mean that the app goes to the background?
Currently, the SDK does not release WebView when the app goes to the background. We don't think it's a big problem because only one WebView is kept, just like when the app is in the foreground. The scripts in the WebView are also stopped.
When the app is terminated, we think that the WebView is released with the app. We have checked that the heap used by the app will be released.
As pointed out in the issue, when using renewVisitorId, the problem that the old user's WebView remains is not considered.
@wasnot "closes the app" means all activities of the app are destroyed. Yes, WebView will be released in this case, because System will kill the process of the app.
@AlanChiou Sorry I made you wait. Today, we have released a version (inappmessaging 2.13.0) that adopts your proposal.
Please confirm. Thank you very much.
Expected Behavior
Before creating a new WebView, you should release and destroy the previous cached WebView. https://github.com/plaidev/karte-android-sdk/blob/d2376314aa3c03f568a1ceed8b43aa5701c93f8a/inappmessaging/src/main/java/io/karte/android/inappmessaging/InAppMessaging.kt#L306
Current Behavior
When there is an existing WebView, you create a new WebView and replace the variable. It causes the previous one leaks.
Possible Solution
Destroy and release the previous one first.
Steps to Reproduce
KarteApp.renewVisitorId()
SDK Version
Android Version
Build Environment
Context Details
We received some crash reports of WebView. This is one of potential root causes.
Logs
Possible Implementation