CleverTap / clevertap-android-sdk

CleverTap Android SDK
MIT License
80 stars 74 forks source link

ANR on Clevertap Sdk initialization (CleverTapAPI.getDefaultInstance) #666

Open bhanu-rapido opened 6 days ago

bhanu-rapido commented 6 days ago

Describe the bug we are initializing the clevertap sdk from application class, and more users are facing a ANR on app startup only. method name we are calling is: CleverTapAPI.getDefaultInstance

To Reproduce

Expected behavior ANR should not happen, or provide a way to initialize on background thread

**Screens

Screenshot 2024-09-12 at 4 36 30 PM

ots/Logs**

Environment (please complete the following information):

Additional context com.rapido.rider_issue_020812ffe500edecedad0d092b35eb37_ANR_session_66E2C93C0064000170E7ED0B885C7CC6_DNE_0_v2_stacktrace.txt

CTLalit commented 5 days ago

@bhanu-rapido yes clevertap can be created on background thread in any standard android way. You can also use clevertap methods like post event and so on on background thread, event though it is not needed and we do all heavy lifting internally on background thread.

We have benchmarked clevertap instance creation and its mean is ~15ms and max is not more than 40ms.

Please raise a support ticket via this link. Clevertap can then help verify your integration and take any further steps, if required.

bhanu-rapido commented 4 days ago

this is how, we are initializing a clevertap sdk and geo-fencing on app startup. the whole block code can be moved to background thread on app startup?

Screenshot 2024-09-14 at 7 23 55 PM
bhanu-rapido commented 2 days ago

also i see the sdk parses the manifest file. have you benchmarked with 30-50 activities, few services, broadcast receiver and metadata ( as our app manifest file is very big) ?

Screenshot 2024-09-16 at 9 07 20 AM