BranchMetrics / android-branch-deep-linking-attribution

The Branch Android SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/pages/apps/android/
MIT License
395 stars 155 forks source link

ANR in io.branch.referral.SystemObserver.isPackageInstalled #1196

Open jjm901 opened 2 months ago

jjm901 commented 2 months ago

Describe the bug

Getting a bunch on ANR's from Android devices when a link callback is received. Not specific to any device or Android version.

Steps to reproduce

  1. ANR occurs after receiving a callback is received from the method Branch.shareLink().
  2. I am using Unity 2022.3.20f1 and Branch 1.0.0 https://github.com/BranchMetrics/unity-branch-deep-linking-attribution.
  3. This issue happens sporadically and not to every user.

Expected behavior

No ANR to occur.

SDK Version

5.2.3

Make and Model

Multiple

OS

Multiple (8.0, 8.1, 10, 11, 12, 13, 14)

Additional Information/Context

According to Google Play Console, the following Insight is provided:

Provided by: Android vitals

Problem: The main thread was busy doing a Binder call that was potentially slow

Recommendation: The latency of a Binder call is hard to predict. It can be affected not only by the complexity of the call itself, but also by intermittent factors such as system server lock contention. You should treat them as you would treat I/O calls, and avoid, if possible, making Binder calls in the main thread. If making a Binder call from the main thread is unavoidable, make sure to instrument and monitor such calls to detect slowness.

In my Unity C# code, I call shareLink with this code:

private void SendLink()
{
   Branch.shareLink(universalObject, linkProperties, message, LinkCallBack);
}

private void LinkCallBack(Dictionary<string, object> parameter, string error)
{
  Debug.Log("Link Call Back - Parameters " + parameters);
}

I receive the message "Link Call Back - Parameters " in Crashlytics when the ANR occurs, and the stack trace from one of the devices is attached.

stacktrace.log

github-actions[bot] commented 1 day ago

This issue has been automatically marked as stale due to inactivity for 60 days. If this issue is still relevant, please respond with any updates or this issue will be closed in 7 days. If you believe this is a mistake, please comment to let us know. Thank you for your contributions.