Closed solikhver closed 2 years ago
Have you made sure that this even fixes #14? I am actually not quite sure... As I have not yet figured out when the DeadObjectException even arises.
My current theory is that the installreferrer API tries to call into InstallReferrerStateListener after the app is actually closed.
This could be fixed by simply calling referrerClient.endConnection()
. Therefor the referrerClients for each call to getInstallReferrer (see the concurency problem above) must be stored in AndroidPlayInstallReferrerPlugin (maybe in a set).
In InstallReferrerStateListener: Call referrerClient.endConnection() and remove from Set In onDetachedFromEngine(): Call referrerClient.endConnection() for all referrerClients that are still in the set.
I dont see a need for storing currentResult as you currently do. The result is referenced from the InstallReferrerStateListener which in turn is referenced by the referrerClient, which is referenced by AndroidPlayInstallReferrerPlugin.
I have modernised implementation. Now we wrapping callback with coroutine and run it in blocking mode. In this case we can be sure that no issues related to concurrency will arrive. It is really fancy implementation that of course relevant to your initial but as you proposed with additional call of referrerClient.endConnection()
Also I have updated dart interface of plugin related to #12
Can you elaborate what the reason for the DeadObjectException is in the first place? I was not really able to figure that out yet...
@solikhver can check if https://github.com/lschmierer/android_play_install_referrer/pull/17 fixes the DeadObjectException?
Thank you for collaboration. I am closing this pull request without merge. As I see you are able to resolve bugs without outside assistance.
Hi, here is refactored implementation. Pleas check and if possible release new version.