From b63c671cc6801c17b48bcc8091fe7dd042e2f268 Mon Sep 17 00:00:00 2001 From: LTphantom <aldobecerril@google.com> Date: Thu, 3 Oct 2024 09:03:31 -0700 Subject: [PATCH] MobileAds.init from a Background thread (#1179) * MobileAds.init from a Background thread * Update Mediation sample Podfile --- .../plugins/googlemobileads/FlutterMobileAdsWrapper.java | 9 ++++++++- samples/admob/mediation_example/ios/Podfile | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterMobileAdsWrapper.java b/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterMobileAdsWrapper.java index d8d9d65c7..159e9294b 100644 --- a/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterMobileAdsWrapper.java +++ b/packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterMobileAdsWrapper.java @@ -36,7 +36,14 @@ public FlutterMobileAdsWrapper() {} /** Initializes the sdk. */ public void initialize( @NonNull Context context, @NonNull OnInitializationCompleteListener listener) { - MobileAds.initialize(context, listener); + new Thread( + new Runnable() { + @Override + public void run() { + MobileAds.initialize(context, listener); + } + }) + .start(); } /** Wrapper for setAppMuted. */ diff --git a/samples/admob/mediation_example/ios/Podfile b/samples/admob/mediation_example/ios/Podfile index 3065706be..2ff9e1af1 100644 --- a/samples/admob/mediation_example/ios/Podfile +++ b/samples/admob/mediation_example/ios/Podfile @@ -37,4 +37,4 @@ post_install do |installer| end end -pod 'GoogleMobileAdsMediationAppLovin' +pod 'GoogleMobileAdsMediationAppLovin', '< 13.0.0.0'