Open remi-ollivier opened 6 days ago
Hey @remi-ollivier thank you for reaching out, can you please share how you are initializing the SDK? and is there a way to bypass that initialization due to any conditioning in your app?
The error mentions the field siteId
is uninitialized while it gets initialized when you initialize the SDK along with in-app module in the Application
class. So it should be the first thing that gets initialized.
Sure!
We have a CustomerIOInitializer
which works like this
private val customerIO: Deferred<CustomerIO?> =
GlobalScope.async(Dispatchers.IO, start = CoroutineStart.LAZY) {
CustomerIO.Builder(
siteId = BuildKonfig.CUSTOMER_IO_SITE_ID,
apiKey = BuildKonfig.CUSTOMER_IO_API_KEY,
appContext = application,
)
.addCustomerIOModule(
ModuleMessagingPushFCM(
config = MessagingPushModuleConfig.Builder().apply {
setNotificationCallback(this@CustomerIOInitializer)
setRedirectDeepLinksToOtherApps(false)
}.build()
)
)
.addCustomerIOModule(ModuleMessagingInApp())
.build()
}
override val instance: Deferred<CustomerIO?> = customerIO
and we access it by calling
customerIOInitializer.instance?.await()
We need to access it asynchronously because the initialization time takes time on our main thread and it causes ANRs, so we try to unload the main thread. Please let me know if you need more information
@remi-ollivier I think late initialization could be the reason because we need to be synchronous. The issue of ANR in your case is also not helpful, but we are discussing this internally how to tackle this. We might make it configurable the first time launching of the in-app to pre-cache the assets which you are reporting as something that causes ANR.
SDK version: 3.10.0
Environment: Production
Are logs available?
Describe the bug App crashes when GistModalActivity is initiated
To Reproduce Happens on production and can not reproduce locally
Expected behavior No crash
Screenshots
Additional context
Happens after we updated the SDK from 3.8.1 to 3.10.0