I was wondering how to include ads into my app. I looked the admob site and tried the firebase thing, but not understanding clearly the whole thing.
Is it really firebase necessary for showing the ad.
what really is the whole thing about.
I was wondering how to include ads into my app.
Add dependency in build.gradle:
compile 'com.google.android.gms:play-services-ads:9.4.0'
and sync the gradle file.
Open the layout you want to add an ad to and:
Or add this code into the xml file:
IN the root element:
xmlns:ads="http://schemas.android.com/apk/res-auto"
And add the view:
<com.google.android.gms.ads.AdView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/adView"
ads:adSize="BANNER|"
ads:adUnitId="@string/your_string_id"
/>
See this link for ad sizes.
Now, you need to initialize the adview. Go to the activity with the layout you edited:
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
Is really firebase necessary for showing the ad?
No it is not. Firebase unites a lot of the tools(including ads) so you can manage everything in one place: a cloud platform. You can use Admob without firebase, but that only means you see the revenue on the admob page, instead of admob and firebase. And there are some analytics tools in Firebase(if I understood correctly) that allows you to better monitor your app.
What really is the whole thing about?
"Firebase is a mobile platform that helps you quickly develop high-quality apps, grow your user base, and earn more money. Firebase is made up of complementary features that you can mix-and-match to fit your needs." - https://firebase.google.com/
It combines all kinds of features into one platform. In addition, if you decide to get the blaze package, you get access to the test lab(testing app on multiple devices).