1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-11-13 22:40:28 -06:00

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,9 +93,13 @@ class AdsHelper @Inject constructor(
private fun initializeMobileAds() { private fun initializeMobileAds() {
if (isMobileAdsInitializeCalled.getAndSet(true)) return if (isMobileAdsInitializeCalled.getAndSet(true)) return
try {
MobileAds.initialize(context) { MobileAds.initialize(context) {
isMobileAdsSdkInitialized.value = true isMobileAdsSdkInitialized.value = true
} }
} catch (e: Exception) {
Timber.e(e)
}
} }
suspend fun getSupportAd(): RewardedInterstitialAd? { suspend fun getSupportAd(): RewardedInterstitialAd? {