Add try catch to initialize MobileAds SDK (#2497)

This commit is contained in:
Rafał Borcz 2024-03-21 11:03:08 +01:00 committed by GitHub
parent e17129efea
commit c9a42a6cf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,8 +93,12 @@ class AdsHelper @Inject constructor(
private fun initializeMobileAds() {
if (isMobileAdsInitializeCalled.getAndSet(true)) return
MobileAds.initialize(context) {
isMobileAdsSdkInitialized.value = true
try {
MobileAds.initialize(context) {
isMobileAdsSdkInitialized.value = true
}
} catch (e: Exception) {
Timber.e(e)
}
}