-
Notifications
You must be signed in to change notification settings - Fork 252
/
Admob.txt
28 lines (22 loc) · 1.1 KB
/
Admob.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//1- add google play service-ads
//2- update the manifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
//3- in manifest.xml application tage add these lines
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" />
//4- layout
xmlns:ads="http://schemas.android.com/apk/res-auto"
<com.google.android.gms.ads.AdView
android:id="@+id/adView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="@string/Banner_Ads"
ads:adSize="BANNER"
/>
//Banner Ads
AdView mAdView = FindViewById<AdView>(Resource.Id.adView1);
var adRequest = new AdRequest.Builder().Build();
// Start loading the ad.
mAdView.LoadAd(adRequest);
//5- update string.xml file
<string name="Banner_Ads">ADD_ID</string>