Add Admob in Android App – Mobile App Development, Android App Development, iphone App Development class="post-template-default single single-post postid-3398 single-format-standard wp-custom-logo"

Add Admob in Android App

Step1:

Create new Project in eclipse.

Add Admob in Android App

Step2:

import Google Play Services library into your workspace.

What is Google Play Services

Step3:

add Google Play Services library into your project.

Right Click on project than open “property” window.

Click on “Android” and add library.

Add Admob in Android App

Step4:

Add your Banner and Interstitial id in “strings.xml”

Example:

[code lang=”js”]
<string name="banner_id">ca-app-pub-7335882925318194/**********</string>
<string name="interstitial_id">ca-app-pub-7335882925318194/**********</string>
[/code]

Add Admob in Android App

Step5:

Give permission for internet inside “manifest.xml”.

[code lang=”js”]
<uses -permission android:name="android.permission.INTERNET"></uses>
[/code]

Copy and paste these lines into you manifest.xml under tag.

 

[code lang=”js”] android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

<meta -data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
[/code]

Add Admob in Android App

Step6:

Create a xml file inside “layout” folder which is under “res” folder. Give file name as “banner_adview.xml”.

Copy and paste these codes into “banner_adview.xml”

[code lang=”js”]
< ?xml version="1.0" encoding="utf-8"?>
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<com .google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/banner_id"
android:visibility="visible"></com>

</linearlayout>
[/code]

Step7:

include “banner_adview.xml” into your “activity_main.xml” by adding these lines into “activity_main.xml”

[code lang=”js”]
<include layout="@layout/banner_adview"
android:layout_width="match_parent"
android:layout_height="wrap_content"></include>
[/code]

Add Admob in Android App

Step8:

create “InterstitialAd” variable into “MainActivity.java”.

[code lang=”js”]
private InterstitialAd interstitial;
add these lines to integrate banner adview into "onCreate()"
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest request = new AdRequest.Builder().build();
adView.loadAd(request);
interstitial = new InterstitialAd(getBaseContext());
interstitial.setAdUnitId(getResources().getString(R.string.interstitial_id));
interstitial.loadAd(request);

and finally add these line for interstitial ad on back pressed button.
@Override
public void onBackPressed() {
if(interstitial.isLoaded()){
interstitial.show();
}
super.onBackPressed();
}
[/code]

Add Admob in Android App

Run your project and check you have successfully added Admob into your app.

Add Admob in Android App


Warning: _() expects exactly 1 parameter, 2 given in /home2/mobilemeri7/public_html/wp-content/themes/mobilemerit/comments.php on line 28

Write a Reply or Comment

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.

https://www.ankihlasnakliyat.com/jigolo siteleri arkadaş bulankara nakliyatankara nakliyatistanbul nakliyatankara nakliyathovarda betantalya çittrbetJigolodiyarijigolo sitesijigolo kayitciporndox.com18avx.comtotoleak.comizmir escort bayanalsancak escortbuca escorttercümanlık bürosuistanbul hair transplant pricejigolo sitelerimjigolo şirketlericast ajans yeni yüzlerjigolo sitelerijigolo başvuruxnxxxvideos62.com
#yaslikurt#>
ümraniye escort ataşehir escort escort bayan
Hack haber Hacklink Hack forum Hd film izle php Shell indir Hack haber