Skip to content

Commit

Permalink
fix: initial Android SDK exception in other thread issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoweii committed Apr 1, 2024
1 parent e5b5ae7 commit ad0f458
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,18 @@ class ClickstreamReactNativeModule(reactContext: ReactApplicationContext) :
val latch = CountDownLatch(1);
try {
reactApplicationContext.runOnUiQueueThread {
ClickstreamAnalytics.init(context, configuration)
latch.countDown()
try {
ClickstreamAnalytics.init(context, configuration)
promise.resolve(true)
isInitialized = true
} catch (exception: Exception) {
promise.resolve(false)
log.error("Clickstream SDK initialization failed with error: " + exception.message)
} finally {
latch.countDown()
}
}
latch.await()
promise.resolve(true)
isInitialized = true
} catch (exception: Exception) {
promise.resolve(false)
log.error("Clickstream SDK initialization failed with error: " + exception.message)
Expand Down

0 comments on commit ad0f458

Please sign in to comment.