-
Notifications
You must be signed in to change notification settings - Fork 440
Moved AdMob init to firebase.init, added AdListener to showBanner() #476
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, does the fact there's no iOS changes mean you didn't notice the delay there?
firebase.android.js
Outdated
@@ -208,6 +208,9 @@ firebase.init = function (arg) { | |||
|
|||
var firebaseAuth = com.google.firebase.auth.FirebaseAuth.getInstance(); | |||
|
|||
// init admob | |||
com.google.android.gms.ads.MobileAds.initialize(appModule.android.context); // TODO not sure its bound to packagename.. this is from the admob-demo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if a user didn't enable AdMob? Let's make this conditional.
Hi!
No, that just mean that I'm only using Android for my project so far.
I would love to do that conditional, but I didn't find a way on how to detect if the user didn't enable AdMob. When you tell me how to check that, I would be happy to update my PR. |
Would be great if you could update the PR! if (typeof(com.google.android.gms.ads) !== "undefined") {
// init admob here
} |
I've updated my PR. I've also moved the code some rows down in the init, because I recognized that I added it into the lines of the auth init. So I moved it down. |
👍 👍 👍 Thanks! |
Thank you for building and maintaining this awesome plugin! Keep up the great work! 👍 |
The initialization of the AdMob plugin takes some time with current plugin-implementation. Showing the first banner could be delayed by a few seconds. Moving AdMob init from
firebase.admob.showBanner()
tofirebase.init
speeds that up a lot.I've also added an
AdListener
tofirebase.admob.showBanner()
, similar to the one already used infirebase.admob.showInterstitial()
. With that we can take care when a banner isn't displayed because of an network error or something else. The current implementation didn't return those kind of errors.