Skip to content

Instantly share code, notes, and snippets.

@maruf00014
Created May 27, 2018 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maruf00014/888dc15aeae8d69fe0f13097eb928997 to your computer and use it in GitHub Desktop.
Save maruf00014/888dc15aeae8d69fe0f13097eb928997 to your computer and use it in GitHub Desktop.
// XML................
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:ads="http://schemas.android.com/apk/res-auto">
<com.google.android.gms.ads.AdView
android:id="@+id/webAdView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
//JAVA......................
MobileAds.initialize(this,getString(R.string.app_ad_id));
AdView adView = findViewById(R.id.webAdView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment