PostHog / posthog-android

PostHog Android SDK
https://posthog.com/docs/libraries/android
MIT License
43 stars 23 forks source link

chore: use getNetworkCapabilities instead of getNetworkInfo to avoid ANRs #164

Closed marandaneto closed 2 months ago

marandaneto commented 2 months ago

:bulb: Motivation and Context

"thread 5" tid=5 Runnable

00 pc 0x000000000005c070 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28)

01 pc 0x000000000014a873 /apex/com.android.art/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+82)

02 pc 0x00000000004d6cdb /apex/com.android.art/lib/libart.so (art::GoToRunnable(art::Thread*)+298)

03 pc 0x00000000004d6b91 /apex/com.android.art/lib/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+8)

at android.os.BinderProxy.transactNative (Native method) at android.os.BinderProxy.transact (BinderProxy.java:571) at android.net.IConnectivityManager$Stub$Proxy.getNetworkInfo (IConnectivityManager.java:1669) at android.net.ConnectivityManager.getNetworkInfo (ConnectivityManager.java:1346) at com.posthog.android.internal.PostHogAndroidContext.getDynamicContext (PostHogAndroidContext.kt:158) at com.posthog.PostHog.buildProperties (PostHog.kt:244) at com.posthog.PostHog.capture (PostHog.kt:363) at com.posthog.PostHog$Companion.capture (PostHog.kt:785) at com.posthog.PostHogInterface$DefaultImpls.capture$default (PostHogInterface.kt:26) at

from google SDK console

:green_heart: How did you test it?

running example

:pencil: Checklist