This PR refactors Iap.java to prevent potential memory leaks by using WeakReference for Context and Activity. This ensures that these references can be garbage collected when necessary, improving memory management.
Changes:
Replaced direct Context and Activity usage with WeakReference.
Updated methods to access Context and Activity using get() from WeakReference.
Motivation:
Avoid memory leaks in cases where the lifecycle of Context or Activity may extend beyond expected, such as during async callbacks or long-running processes.
This PR refactors
Iap.java
to prevent potential memory leaks by using WeakReference forContext
andActivity
. This ensures that these references can be garbage collected when necessary, improving memory management.Changes:
Context
andActivity
usage withWeakReference
.Context
andActivity
usingget()
fromWeakReference
.Motivation:
Avoid memory leaks in cases where the lifecycle of
Context
orActivity
may extend beyond expected, such as during async callbacks or long-running processes.