AdMob is a multi platform mobile ad network that allows you to monetize your android app. By integrating AdMob you can start earning right away. It is very useful particularly when you are publishing a free app and want to earn some money from it.
Integrating AdMob is such an easy task that it takes not more than 5mins. In this article we’ll build a simple app with two screen to show the different types of ads that AdMob supports.
1. Type of AdMob Ads
AdMob currently offers below types of ad units. You can choose the ad format depending on your app criteria.
> Banner Ad
Banner Ads occupies only portion of the screen depending on the ad size that is created. It comes in multiple sizes Standard, Medium, Large, Full-Size, Leaderboard and Smart Banner. Smart banners are very useful when you target multiple device sizes and fit the same ad depending on the screen size.
> Interstitial Ad
Interstitial ads occupies full screen of the app. Basically they will shown on a timely basis, between screen transition or when the user is done with a task. Usually we can see these ads in games displaying Ad when a level is completed.
> Rewarded Video Ad
Rewarded Video Ads are fullscreen video ads which offers some reward points if the user watches the ad video. These ads are very useful to offer some reward points / coins in video games.
> Native Ad
Native Ads offers flexibility to configure the ad appearance like color, text color and buttons to make them appear as native component of the app.
> Native Express (Deprecated)
Starting March 1, 2018 the Native Express ads will be discontinued.
> Native Advanced (Beta)
Native Advanced ads are still in Beta program and not available to everyone. This article will be updated once the feature is available publicly.
2. Creating Ad Units
Note: AdMob admin interface changes quite often. The below steps to create Ad Unit IDs might differ time to time.
1. Sign into your AdMob account.
2. Create a new App by giving the package name of the app you want to integrate AdMob. Once the App is created, you can find the APP ID on the dashboard which looks like ca-app-pub-XXXXXXXXX~XXXXXXXXX.
3. Select the newly created App and click on ADD AD UNIT button to create a new ad unit.
4. Select the ad format and give the ad unit a name.
5. Once the ad unit is created, you can notice the Ad unit ID on the dashboard. An example of ad unit id look like ca-app-pub-066XXXXXXX/XXXXXXXXXXX
Create as many ad units required for your app.
3. Creating New Project
1. Create a new project in Android Studio from File ⇒ New Project. When it prompts you to select the default activity, select Empty Activity and proceed.
2. Open build.gradle and add play services dependency as AdMob requires it.
compile ‘com.google.android.gms:play-services-ads:11.8.0’
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:26.1.0' compile 'com.android.support:design:26.1.0' compile 'ccom.google.android.gms:play-services-ads:11.8.0' }
3. Add the App ID and Ad unit IDs to your strings.xml. Open strings.xml located under res ⇒ values and add the IDs of all the ad units.
<resources> <string name="app_name">AdMob</string> <string name="title_activity_second_activiy">Interstitial</string> <string name="msg_welcome">Welcome to Admob. Click on the below button to launch the Interstitial ad.</string> <string name="btn_fullscreen_ad">Show Interstitial Ad</string> <string name="btn_rewarded_video">Show Rewarded Video Ad</string> <!-- TODO - add your ad unit Ids --> <!-- AdMob ad unit IDs --> <string name="admob_app_id">ca-app-pub-XXXXXXXX~XXXXXXXXXXX</string> <string name="banner_home_footer">ca-app-pub-XXXXXXXX~XXXXXXXXXXX</string> <string name="interstitial_full_screen">ca-app-pub-XXXXXXXX~XXXXXXXXXXX</string> <string name="rewarded_video">ca-app-pub-XXXXXXXX~XXXXXXXXXXX</string> </resources>
4. Create a class named MyApplication.java and extend the class from Application. In this application class we have to globally initialize the AdMob App Id. Here we use MobileAds.initialize() method to initialize the AdMob.
(Note: App ID is different from Ad Unit ID. Place the App ID carefully)
import android.app.Application; import com.google.android.gms.ads.MobileAds; /** * Created by ravi on 25/12/17. */ public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); // initialize the AdMob app MobileAds.initialize(this, getString(R.string.admob_app_id)); } }
5. Open AndroidManifest.xml and add MyApplication to <application> tag to execute the class on app launch.
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="info.androidhive.admob"> <application android:name=".MyApplication" ...> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
3.1 Adding Banner Ad
Banner ads occupies only a portion of the screen. I am adding a banner ad in my main activity aligning to bottom of the screen. In order to add the banner ad, you need to add com.google.android.gms.ads.AdView element to your xml layout.
<com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="@string/banner_home_footer"> </com.google.android.gms.ads.AdView>
6. Open the layout file of your main activity (activity_main.xml) and add the AdView widget. I am also adding a button to launch another in which we’ll try Interstitial ad.
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="info.androidhive.admob.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/msg_welcome" /> <Button android:id="@+id/btn_fullscreen_ad" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="@string/btn_fullscreen_ad" /> <Button android:id="@+id/btn_show_rewarded_video" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/btn_fullscreen_ad" android:layout_centerHorizontal="true" android:layout_marginTop="10dp" android:text="@string/btn_rewarded_video" /> <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" ads:adSize="BANNER" ads:adUnitId="@string/banner_home_footer"></com.google.android.gms.ads.AdView> </RelativeLayout>
7. Open MainActivity.java and modify the code as shown.
> Create an instance of AdRequest and load the ad into AdView.
> Ad the AdView life cycle methods in onResume(), onPause() and in onDestroy() methods.
package info.androidhive.admob; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.google.android.gms.ads.AdListener; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.AdView; public class MainActivity extends AppCompatActivity { private AdView mAdView; private Button btnFullscreenAd, btnShowRewardedVideoAd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnFullscreenAd = (Button) findViewById(R.id.btn_fullscreen_ad); btnShowRewardedVideoAd = (Button) findViewById(R.id.btn_show_rewarded_video); btnFullscreenAd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, InterstitialAdActivity.class)); } }); btnShowRewardedVideoAd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, RewardedVideoAdActivity.class)); } }); // TODO - remove this if condition // it's for demo purpose if (TextUtils.isEmpty(getString(R.string.banner_home_footer))) { Toast.makeText(getApplicationContext(), "Please mention your Banner Ad ID in strings.xml", Toast.LENGTH_LONG).show(); return; } mAdView = (AdView) findViewById(R.id.adView); mAdView.setAdSize(AdSize.BANNER); mAdView.setAdUnitId(getString(R.string.banner_home_footer)); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // Check the LogCat to get your test device ID .addTestDevice("C04B1BFFB0774708339BC273F8A43708") .build(); mAdView.setAdListener(new AdListener() { @Override public void onAdLoaded() { } @Override public void onAdClosed() { Toast.makeText(getApplicationContext(), "Ad is closed!", Toast.LENGTH_SHORT).show(); } @Override public void onAdFailedToLoad(int errorCode) { Toast.makeText(getApplicationContext(), "Ad failed to load! error code: " + errorCode, Toast.LENGTH_SHORT).show(); } @Override public void onAdLeftApplication() { Toast.makeText(getApplicationContext(), "Ad left application!", Toast.LENGTH_SHORT).show(); } @Override public void onAdOpened() { super.onAdOpened(); } }); mAdView.loadAd(adRequest); } @Override public void onPause() { if (mAdView != null) { mAdView.pause(); } super.onPause(); } @Override public void onResume() { super.onResume(); if (mAdView != null) { mAdView.resume(); } } @Override public void onDestroy() { if (mAdView != null) { mAdView.destroy(); } super.onDestroy(); } }
Now if you run the app, you should see a banner ad at the bottom of your screen.
3.2 Adding Interstitial Ad (Fullscreen Ad)
Interstitial ads occupies full screen of the app. Adding interstitial ad doesn’t require an AdView element to be added in the xml layout. Rather we load the ad programatically from the activity. Normally these ads will be populated when user is moving between activities or moving to next level when playing a game.
We’ll test this ad by creating a second activity and popup the full screen ad when the second activity is launched.
8. Create an activity named SecondActivity.java by right clicking on package New ⇒ Activity ⇒ Empty Activity.
package info.androidhive.admob; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.Toast; import com.google.android.gms.ads.AdListener; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.InterstitialAd; public class SecondActivity extends AppCompatActivity { private String TAG = SecondActivity.class.getSimpleName(); InterstitialAd mInterstitialAd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); mInterstitialAd = new InterstitialAd(this); // set the ad unit ID mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen)); AdRequest adRequest = new AdRequest.Builder() .build(); // Load ads into Interstitial Ads mInterstitialAd.loadAd(adRequest); mInterstitialAd.setAdListener(new AdListener() { public void onAdLoaded() { showInterstitial(); } }); } private void showInterstitial() { if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); } } }
Now if you run the app, you can see the interstitial ad when the second activity is launched.
3.3 Adding Rewarded Video Ad
9. Create another activity named RewardedVideoAdActivity.java and add the below code. This is same as Interstitial but there will be a callback method onRewarded() called when there is a reward after watching the video ad completely.
import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.MobileAds; import com.google.android.gms.ads.reward.RewardItem; import com.google.android.gms.ads.reward.RewardedVideoAd; import com.google.android.gms.ads.reward.RewardedVideoAdListener; public class RewardedVideoAdActivity extends AppCompatActivity { private RewardedVideoAd mRewardedVideoAd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_rewarded_video_ad); mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this); mRewardedVideoAd.setRewardedVideoAdListener(new RewardedVideoAdListener() { @Override public void onRewarded(RewardItem rewardItem) { Toast.makeText(RewardedVideoAdActivity.this, "onRewarded! currency: " + rewardItem.getType() + " amount: " + rewardItem.getAmount(), Toast.LENGTH_SHORT).show(); } @Override public void onRewardedVideoAdLeftApplication() { Toast.makeText(RewardedVideoAdActivity.this, "onRewardedVideoAdLeftApplication", Toast.LENGTH_SHORT).show(); } @Override public void onRewardedVideoAdClosed() { Toast.makeText(RewardedVideoAdActivity.this, "onRewardedVideoAdClosed", Toast.LENGTH_SHORT).show(); } @Override public void onRewardedVideoAdFailedToLoad(int errorCode) { Toast.makeText(RewardedVideoAdActivity.this, "onRewardedVideoAdFailedToLoad", Toast.LENGTH_SHORT).show(); } @Override public void onRewardedVideoAdLoaded() { Toast.makeText(RewardedVideoAdActivity.this, "onRewardedVideoAdLoaded", Toast.LENGTH_SHORT).show(); } @Override public void onRewardedVideoAdOpened() { Toast.makeText(RewardedVideoAdActivity.this, "onRewardedVideoAdOpened", Toast.LENGTH_SHORT).show(); } @Override public void onRewardedVideoStarted() { Toast.makeText(RewardedVideoAdActivity.this, "onRewardedVideoStarted", Toast.LENGTH_SHORT).show(); } }); loadRewardedVideoAd(); } private void loadRewardedVideoAd() { mRewardedVideoAd.loadAd(getString(R.string.rewarded_video), new AdRequest.Builder().build()); // showing the ad to user showRewardedVideo(); } private void showRewardedVideo() { // make sure the ad is loaded completely before showing it if (mRewardedVideoAd.isLoaded()) { mRewardedVideoAd.show(); } } @Override public void onResume() { mRewardedVideoAd.resume(this); super.onResume(); } @Override public void onPause() { mRewardedVideoAd.pause(this); super.onPause(); } @Override public void onDestroy() { mRewardedVideoAd.destroy(this); super.onDestroy(); } }
3.4 Enabling Test Ads
As per AdMob Policies you are not allowed to click on your own live ads. In order to protect your AdMob account from getting suspended, use test ads during development as you might click the ads accidentally.
When you run the project, if you monitor the LogCat, you can find a similar line Use AdRequest.Builder.addTestDevice(“C04B1BFFB0774708339BC273F8A43708”) to get test ads on this device. Copy the device id and add it to AdRequest as shown below. Note that this ID varies from device to device, By doing this, the test ads will be loaded instead of live ads.
In production you need to make sure that you removed addTestDevice() methods in order to render the live ads and start monetization.
AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // Check the LogCat to get your test device ID .addTestDevice("C04B1BFFB0774708339BC273F8A43708") .build();
3.5 Ad View Listeners
Ad listeners are very useful to perform the next action when ad is closed. Below are the ad listeners can be used to notify your app when ad changes its state.
mAdView.setAdListener(new AdListener() { @Override public void onAdLoaded() { Toast.makeText(getApplicationContext(), "Ad is loaded!", Toast.LENGTH_SHORT).show(); } @Override public void onAdClosed() { Toast.makeText(getApplicationContext(), "Ad is closed!", Toast.LENGTH_SHORT).show(); } @Override public void onAdFailedToLoad(int errorCode) { Toast.makeText(getApplicationContext(), "Ad failed to load! error code: " + errorCode, Toast.LENGTH_SHORT).show(); } @Override public void onAdLeftApplication() { Toast.makeText(getApplicationContext(), "Ad left application!", Toast.LENGTH_SHORT).show(); } @Override public void onAdOpened() { Toast.makeText(getApplicationContext(), "Ad is opened!", Toast.LENGTH_SHORT).show(); } });
4. Known Issues
While running the app, the Ads might not display and the below errors can be seen in LogCat.
> There was a problem getting an ad response. ErrorCode: 1
> Failed to load ad: 1
If you happen find the above errors in your LogCat, there is no need worry. The newly created Ad Units takes few hours to display the actual ad. Until then you will see these errors. The best way to resolve this problem is to wait for few hours and test the app again.
Updated On | 25th Dec, 2017 (Content Update, Latest Ad Formats) |
Hi there! I am Founder at androidhive and programming enthusiast. My skills includes Android, iOS, PHP, Ruby on Rails and lot more. If you have any idea that you would want me to develop? Let’s talk: ravi@androidhive.info
plzzz xplain how to get money?????????????????????
Place these ads in your apps. You will get money when somebody clicks on the ad.
thank u so much………
Hello, I want to Implement Video Ads
So please any other that display video ads and alternative of admob
Can I put an ad of my own and get money for it? or do I need to close a deal with a real company who wants to advertise on my app?
e.g. Can I put an ad that says: “click me”, and get money if someone clicks it (although it will do nothing special…?
Thanks!
No you can’t do that using AdMob. What you are looking for BuySellAds (It supports only web). May be you can check any providers who is doing this for android apps.
plzzzz give some example for android Responsive preview
is it advisable to place such ads on a social network?? Just wondering
Thanks Ravi . it will be helpful if you could provide video regarding registering on admob and getting real ids.
Its nothing complex. It takes only two steps which I shown it in the image. And all the ads are real ads. We’ll make them as test ads in the code.
Thank you 🙂 . But what about things like attaching my account details / paypal account with admob (i don’t know exactly this is the right way or not)
All the details can be managed from AdMob admin panel. Just login once and check
reply
Hi
thank you for this explain
I have problem with this code
see
Ads: Ad is not visible. Not refreshing ad.
Ads: Scheduling ad refresh 60000 milliseconds from now.
what I can do ?
I am not sure what the error is. It seems there are lot of reasons for the error.
http://stackoverflow.com/questions/22593653/ad-is-not-visible-not-refreshing-ad-after-screen-off
http://stackoverflow.com/questions/29923016/admob-ads-not-showing-getting-ad-is-not-visible-not-refreshing-ad
http://stackoverflow.com/questions/21996175/ad-is-not-visible-not-refreshing-ad
My Friend,
I am inform you your post is – http://www.androidhive.info/2012/08/android-session-management-using-shared-preferences/
is lost of copy found in google search – check this copy content link..
http://www.java4you.in/2014/08/android-user-session-management-using.html
Request to remove this post copy right post.
Thank You, I contacted them.
Hello !!
hello..hi
Hi plss dont mind if i ask you a questn Ravi Tamanda do you use a commenting 3rd party or this comment section is made by your own??? Plss let me know if your using a 3rd party..then i will also use it..thnxx in advance..
Yeah, it’s third party and free. Here it is (Disqus)
https://disqus.com/
hai ravi could u teach me how to create swipeable tabs using JSON valley.
I think the stuff in the AndroidManifest are not necessary. They are required if you use Eclipse, but in Android Studio they are not needed. Proof: https://developers.google.com/admob/android/quick-start
Yeah, I kept the in mind about both the cases.
Thanks for this post…… came up exactly when I needed it the most. Other posts were kinda outdated……..
Yeah, it’s late but updated one.
How to insert admob ad in to listview?
I think it’s against AdMob policies to place it listview.
Hi, i am displaying fragment through Activity…So, How can i place Adview in fragment.?
if i add adview in Activity_main.xml .. its showing but not floating and clickable.
Wouu thank you for the example…. actually i begin work with Ads, but i have a question…
I need implement a VIDEO ad.. name PRE-ROLL i search and google work with IMA:
https://developers.google.com/interactive-media-ads/docs/sdks/android/quickstart
AdMob have the same tecnologie?
We have the same app for Android and IOS. can we use the same adUnit ID for both?
I don’t think you can use same Unit ID for both. When we creating the app, it is asking to select the platform (check the screenshot) where we are defining the platform.
great tutorial. keep sharing
Hello Ravi, From many times i am folowing your tutorials and its very helpful, one problem i am suffering from 2-3 days is that OutOfMemory error in loading images. i have image automatic slider in my app. so when i start running on mobile , it throws error of outofmemoryerror in logcat . please help me to solve.
I did not know how to set background of layout or load image from Bitmap drawable so i directly load in tag.
for background
Thanks in advance @Ravi Tamada:disqus
Don’t keep the image directly on LinearLayout. Compress the image as much as possible before adding to project. Use https://tinypng.com/ to compress the image.
Also while setting the background, set the image programatically instead of setting in xml. Use the below function to compress the image and set as background to linearlayout.
Try the below line once
getWindow().setBackgroundDrawableResource(R.drawable.bg_view_full);
can anyone help me on gradle sync failed:Gradle DSL method not found: ‘compile()’
Consult IDE log for more details (Help | Show Log)
Hi,
I have vertically scrollable edittext inside scrollview .
when enter key pressed layout auto scrolling. could you please help.
thanks in advance @Ravi Tamada:disqus
Hi Ravi adMob is great, No doubt. but it is not showing any impression on slideMe market devices and not even Analytics are working there. Could you suggest me something for this context.
HI Thanks
very useful
Sorry please for me ask
I viewed all your post on android but not view post toturial Service of android.You can write post service Android ?
If can i very grateful you because service i see it very important in some app good.Thanks
Hi Ravi,
Hope you are doing well. I have followed you on numerous topics for learning android app development. Please advise if you also take classes or guide.
Eagerly waiting for your advise.
Thanks,
Regards,
Deep Shikha
No Shikha I don’t. Only blogging ..:)
Hi Ravi,
I enjoyed your tutorials. I hope you do a tutorial on integrating Native ads admob or facebook into RecyclerView .
Thanks,
Regards
Hi Ravi, Im totally new to this stuff so sorry for noob questions.
I am using Navigation-Drawer in my application(i have followed your material desing tutorials). So I have created single activity with navigation_drawer layout. I am using fragments to change main content area data whenever user chooses a menu option from navigation drawer menu.Now my problem is that I want to show admob ad on every screen and when opening the navigation drawer the ad will be under the navigation menu.
My question is: is there any conflict or contrast with the AdMob Policies ?
brother, why your web deindexed on google search? only 1 page being indexed
Hi rekian
Thanks for letting me know. I am checking it right away.
Hello ravi, I have a small issue.I don’t think how logical it is. What if I wished to add only desired app from playstore. For example I just want to display facebook and twitter add randomly.How can I do that if it is possible to do?
Great Tutorial !
Hello Ravi bhai, great tutorial. Can you please tell me how do you created that video.Please.
I recored the video on my mobile and used Camtasia studio to edit the video.
Thank you Ravi bhai for your reply.
without publishing app…i can earn through adMob??
No, you can’t
you can if you did publish app in other markets
Thanks, was able to adapt the code here to display banner and interstitial ads in fragments 😉 cheers bro
Cheers!
getting error while adding dependency to gradle. Error-> failed to resolve:com.google.android.gms:play-services-ads:8.4.0 and compile&target sdk-23, min-14. Help me on this ravi!!
download the m2 repository manually or let the Gradle sync so it would be able to add the dependancy.
Hai Ravi sir
I have ad mob using ad created. in that case i have getting some blank page kindly help me how to resolved in this problem
i have attached the link below
http://stackoverflow.com/questions/36835494/admob-is-working-but-getting-blank-page
thanks man .
helped alot.
thanks!
thanks bro…
i face a problem console error :- Failed to load ad: 0
how to solve this problem.
I’m facing the same issue, my app is play store but with no ads.
While in development I’ve added the .addTestDevices but on production I removed it and no one that downloaded the app sees ads.
I have create a new ad-unit with no luck
As salam o alaikum, issue is that you guys might be taking app id from app-management page on admob account, don’t take it from there take app-pub id from Monetize tab and under all apps check the ad unit you made use this id in app. hope this helps.!!
Hi Ravi …
Thanks for the tutorial everything is working fine…. can you please guide me how to integrate Video ads in android studio and one question more how to generate video Ad id in admob …. Thank you in advance dear
brother as far as i know, look at the image where Ravi bhai showed admob screen shots, there is also video available, i think same method will work for image/Text and video ads in Interstitial Ad.
please add Admob native ads example, these tutorials are the best, easy and simple , with good explanation
hello ravi , how can I put my own ads in a banner like that , but not by google ads, like my own ads banner’? thank you brother
For that you don’t need AdMob, you can just show Fragment Dialog with fullscreen ImageView in it. But why do you want to do that?
Did you implement that?
This works great on the emulator. When I run it on my phone, I don’t see the ad. What could be the problem?
Add this line in manifest.xml
can you give example of new ad feature like native
Nice tutorial Sir. Im a big fan of your,blog. Do you mind giving a tutorial on adding an add mob banner after 5 items in a listview or Recyclerview, something related to facebook feeds
how do get the live add eventhough i removed addTestDevice method i did not get live add why?
i got test add eventhough i removed addTestDevice method i did not get live add why?
anyone will quickly response
only one add is showing how to display different-different adds, i mean live ads. can we manage through AdMob site which adds should be display in app ?
hii ravi I am using your code to integrate adMob in my app. But it only display InterstitialAd not show the video ads. i set the only video in google admob account.
I guess, google decides which ad to show depending on the user.
Ravi maybe it’s late to congratulate you but you deserve that. thanks bro 🤓
Cheers Amigo 🙂
Hi Ravi, I include your code of admob but cant load and Show Adsruntime in my app
all procedur completed……………help
Hi Ravi
I want to display interstitial ad before the activity launch. Like once ads displayed then only i want to show the my activity. If possible could you please share your inputs.
Hello Ravi thanks for this its very easy code
Ravi plz give me some code about “Android GPS Tracking with Google map”
I am not sure this helps or not. But try this
http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/
hello every body,
it’s been 24 hours i have this problem please any one could help
the error is : Error inflating class com.google.ads.AdView
I wonder you are working in eclipse
if so then i recommend you to switch to Android Studio coz i also had this problem and couldn’t find any solution for this but if you are working in Studio then there should’t be any problem if you have included the google play services in the app
But if u get any solution to this don’t forget to share it
Hope it helps