Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call MobileAds.initialize on background thread #1135

Closed
blaugold opened this issue Jul 15, 2024 · 8 comments
Closed

Call MobileAds.initialize on background thread #1135

blaugold opened this issue Jul 15, 2024 · 8 comments
Assignees
Labels
in triage Issue currently being evaluated

Comments

@blaugold
Copy link

blaugold commented Jul 15, 2024

The Google Ads team now recommends calling MobileAds.initialize on a background thread to avoid ANRs.

Currently, this Plugin calls MobileAds.initialize on the UI thread.

flutterMobileAds.initialize(context, new FlutterInitializationListener(result));

@malandr2
Copy link
Collaborator

Hi @blaugold, thanks for flagging. I've shared this with engineering to determine next steps.

@malandr2 malandr2 added the in triage Issue currently being evaluated label Jul 15, 2024
@Gilianp
Copy link

Gilianp commented Sep 5, 2024

Is there any workaround we can do on the flutter side while this lib is not updated? Can we call MobileAds.initialize in another Isolate safely?

@malandr2
Copy link
Collaborator

malandr2 commented Sep 5, 2024

Hi @Gilianp, we have a PR in the works #1165 that will be included in the next version. Please see until it's submitted

@Gilianp
Copy link

Gilianp commented Sep 5, 2024

Hi @Gilianp, we have a PR in the works #1165 that will be included in the next version. Please see until it's submitted

Thanks @malandr2 , I will wait the next update!

@marcellocamara
Copy link

marcellocamara commented Sep 14, 2024

@malandr2
Copy link
Collaborator

Hi @marcellocamara, those flags are optional. They are needed if you're not calling MobileAds.initialize on a background thread. When the google_mobile_ads plugin adds the background thread functionality, these flags will no longer be needed in our samples. See https://developers.google.com/admob/android/optimize-initialization#update_your_manifest_file for more details

@malandr2
Copy link
Collaborator

malandr2 commented Oct 7, 2024

This has been resolved in #1179 and will be included in the next release .5.2.0

@malandr2 malandr2 closed this as completed Oct 7, 2024
@peterweb2005
Copy link

peterweb2005 commented Oct 9, 2024

@LTPhantom thanks
is that, seems there is InitializationStatus return, or related,
so the (my) app shouldn't await MobileAds.instance.initialize()?
thanks

update

thanks, resolved
i knew that is about the platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in triage Issue currently being evaluated
Projects
None yet
Development

No branches or pull requests

6 participants