Skip to content

Conversation

@giawa
Copy link

@giawa giawa commented Nov 16, 2025

Hello Facebook! I'm trying this PR again, which got closed as stale by your bot previously. @rageandqq any chance you can take a look?

  • ✅ sign contributor license agreement
  • ❓ I've ensured that all existing tests pass and added tests (when/where necessary)
  • ✅ I've updated the documentation (when/where necessary) and Changelog (when/where necessary)
  • 🚫 I've added the proper label to this pull request (e.g. bug for bug fixes) (I don't seem to have permission to do this)

Pull Request Details

We have an issue with high ANR rates on our Unity app, and the stack trace points to these two long standing open issues with this SDK:

I am not a Kotlin expert, but it seemed like this was a simple change to bring the call to referrerClient.installReferrer over to a different thread.

Warning

This change assumes it is okay to make the callback from a different thread than tryConnectReferrerInfo. In my brief check of the codebase, this looked okay, but if necessary we may want to bring the callback back to the main thread.

While doing this, I noticed that the try/catch for cleaning up the referrerClient wouldn't work if an exception was thrown from referrerClient.installReferrer, so I moved that cleanup to a finally block instead.

Test Plan

I have run the test app, but cannot test this code quite yet in my own app, as I haven't explored how to bring this over to Unity. I was hoping by starting here with this repository so I could get feedback before trying to get this brought in to the Unity package as well.

If there is something I can do to help test this, please let me know! My goal here is to get the ball rolling with this conversation so that we can address the high ANR rates caused by this SDK.

giawa added 2 commits April 4, 2025 10:51
…t it can't block the main thread with slow binder calls.

See facebook#1039
See facebook/facebook-sdk-for-unity#672

Also bring the cleanup of referrerClient into the try/catch in the thread.  I believe this addresses an existing issue where if the call to referrerClient.installReferrer throws an exception then we never clean up the referrerClient.
@meta-cla meta-cla bot added the CLA Signed label Nov 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant