then you need to insert these codes in three places:
In the manifest
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-******************~**********" />
In the layout
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-***************/************" />
in the app
MobileAds.initialize(this,"ca-app-pub-*********/*******");
myAd=findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
myAd.loadAd(adRequest);
Remember that you will need internet permissions.
No comments:
Post a Comment