Rapid Subscribe Android App

Rapid Subscribe Android App
Rapid Subscriber

Breaking News

How to create an Admob Banner ad in Android App | Place Admob Banner Ads




If you are an Android Developer and want to earn money from your android app. Then you have to place Ads in your Android App.

There is some type of ads you can place in your Android App.



Today, In this post we learn how to create a Banner ad in your Android App.

To place a Banner Ad, we have to create a new Admob Account and add your app there and then create a new Banner Ad there and create Ad unit Id. seen in the pictures below.


Your Application Name


Type of Ad


Banner Ad set-up


Then, in Android Studio, first, we have to add new google ads dependency in our app-level Gradle file.

app-level Gradle file
 implementation 'com.google.android.gms:play-services-ads:18.3.0'  

Then, we create a banner ad layout in our XML file.

MainActivity.xml

 <?xml version="1.0" encoding="utf-8"?>  
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   xmlns:app="http://schemas.android.com/apk/res-auto"  
   xmlns:tools="http://schemas.android.com/tools"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent"  
   tools:context=".MainActivity">  
   <TextView  
     android:layout_width="wrap_content"  
     android:layout_height="wrap_content"  
     android:text="Hello World!"  
     app:layout_constraintBottom_toBottomOf="parent"  
     app:layout_constraintLeft_toLeftOf="parent"  
     app:layout_constraintRight_toRightOf="parent"  
     app:layout_constraintTop_toTopOf="parent" />  
   <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"  
     android:layout_gravity="bottom|center"  
     app:adSize="BANNER"  
     app:adUnitId="@string/bannerAdMobId">  
     </com.google.android.gms.ads.AdView>  
 </LinearLayout>  

Then place your application id in your manifest.xml under meta-data tag

For Application Id open your Admob Account and open your Ad unit then click on implementation instructions, Upper one which contains tilde (~) sign is your Application id and another one is your Ad unit Id.



Application Id and Ad Unit Id


AndroidManifest.xml

 <meta-data  
       android:name="com.google.android.gms.ads.APPLICATION_ID"  
       android:value="@string/bannerAdAppId" />  

Then create an instance and find the id in MainActivity.java and Load your Banner Ad

MainActivity.java
 public class MainActivity extends AppCompatActivity {  
   AdView madview;  
   @Override  
   protected void onCreate(Bundle savedInstanceState) {  
     super.onCreate(savedInstanceState);  
     setContentView(R.layout.activity_main);  
     madview = findViewById(R.id.adView);  
     AdRequest adRequest = new AdRequest.Builder().addTestDevice("XXXXXXXXXXXXXXXXXXXXXX").build();  
     madview.loadAd(adRequest);  
   }  
 }  

 Here, we load our ad and also add a test device because we run this ad through debugging. For test device id you can see logs of Ad-request inside run tab in Android Studio.


Find Test Device Id to run Banner Ad
  


Follow us for more posts like this, 
Subscribe Harpreet studio on Youtube  
Like Harpreet Studio on Facebook  
Follow me on Instagram 

41 comments:

  1. Great articles and great layout. Your blog post deserves all of the positive feedback it’s been getting. Phone Spy Apps

    ReplyDelete
  2. As always as widespread contractors go look at this web-site, app company
    agencies you're in inappropriate hands with those men!

    ReplyDelete
  3. The evolution of modern business is reflected in the growth of digital agencies. The concept of a digital agency, being relatively young, is clouded, vague and varying. Digital marketing

    ReplyDelete
  4. Some really marvelous work on behalf of the owner of this web site , dead great subject matter. iOS developer

    ReplyDelete
  5. Some really marvelous work on behalf of the owner of this web site , dead great subject matter. unlimited reseller hosting

    ReplyDelete
  6. Some really marvelous work on behalf of the owner of this web site , dead great subject matter. kiss918 apk

    ReplyDelete
  7. Some really marvelous work on behalf of the owner of this web site , dead great subject matter. kiss918

    ReplyDelete
  8. I like this site so much, saved to favorites . pussy888

    ReplyDelete
  9. Some really marvelous work on behalf of the owner of this web site , dead great subject matter. book accommodation in Gauteng

    ReplyDelete
  10. I absolutely love your blog and find a lot of your post’s to be exactly I’m looking for. can you offer guest writers to write content to suit your needs? I wouldn’t mind writing a post or elaborating on a few of the subjects you write in relation to here. Again, awesome weblog! XE88

    ReplyDelete
  11. Get started with wales ahead nearly every planking. Ones wales truly are a compilation of huge planks one particular depth advisors certainly is the identical to the entire hull planking however with even larger density to successfully thrust outward beyond the planking. planking ICCRC Agents in Dubai

    ReplyDelete
  12. I adore your wp web template, wherever would you obtain it through? buy copiers

    ReplyDelete
  13. Hi! Great post! Please do tell us when I will see a follow up! mega888 apk

    ReplyDelete
  14. Some really marvelous work on behalf of the owner of this web site , dead great subject matter. Islamic Apps

    ReplyDelete
  15. Quickly and easily build your web traffic and PR, which provides Web site visitors to add your page to any social bookmarking website. best reseller hosting

    ReplyDelete
  16. You have done a great job on this article. It’s very readable and highly intelligent. You have even managed to make it understandable and easy to read. You have some real writing talent. Thank you. BizOp

    ReplyDelete
  17. Great post, you have pointed out some fantastic points , I likewise think this s a very wonderful website. 안전놀이터

    ReplyDelete
  18. Thanks so much for this information. I have to let you know I concur on several of the points you make here and others may require some further review, but I can see your viewpoint. 온라인릴게임

    ReplyDelete
  19. Quickly and easily build your web traffic and PR, which provides Web site visitors to add your page to any social bookmarking website. Lodges in ladysmith

    ReplyDelete
  20. Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!Thanks nursing test bank

    ReplyDelete
  21. I certainly appreciate your stuff provided in the blogs.
    logo companies designers

    ReplyDelete
  22. Continue the good work; keep posting more n more n more.
    top 10 website design company

    ReplyDelete
  23. House Lawyers… [...]just below, are some totally unrelated sites to ours, however, they are definitely worth checking out[...]… therapy

    ReplyDelete
  24. Good job on this article! I really like how you presented your facts and how you made it interesting and easy to understand. Thank you. Music for Sleeping

    ReplyDelete
  25. Good job on this article! I really like how you presented your facts and how you made it interesting and easy to understand. Thank you. Music for Stress Relief

    ReplyDelete
  26. Thanks for the write up! Also, just a heads up, your RSS feeds aren’t working. Could you take a look at that? เว็บหวยที่ดีที่สุด

    ReplyDelete
  27. Remarkably! It is as if you read my mind! A person appear to know therefore considerably relating to this, just like you authored the book inside it or something. I feel that you can do with a few images to drive the content residence a bit, on top of that, this really is great weblog. The outstanding study. I will definitely review again. เว็บซื้อหวยออนไลน์

    ReplyDelete
  28. I’m agitated all these article directories. It sure would be nice to have every article directory that instantly accepts articles. 해외 사이트

    ReplyDelete
  29. I’m agitated all these article directories. It sure would be nice to have every article directory that instantly accepts articles. เว็บแทงบอล

    ReplyDelete
  30. Just wanna input on few general things, The website design is perfect, the articles is very great : D. แทงบอลพรีเมียร์ลีก

    ReplyDelete
  31. Just wanna input on few general things, The website design is perfect, the articles is very great : D. สมัครแทงบอลลีกอังกฤษ

    ReplyDelete
  32. Just wanna input on few general things, The website design is perfect, the articles is very great : D. เดิมพันบอลอังกฤษ10บาท

    ReplyDelete
  33. Thank you for an additional great post. Exactly where else could anybody get that kind of facts in this kind of a ideal way of writing? I have a presentation next week, and I’m around the appear for this kind of data. CBD Doctors

    ReplyDelete
  34. Easily that good web page will clearly irrefutably regularly be well known in the midst of almost all publishing some sort of blog site individuals, mainly because conscientious information together with stories. 메이저놀이터

    ReplyDelete
  35. Easily that good web page will clearly irrefutably regularly be well known in the midst of almost all publishing some sort of blog site individuals, mainly because conscientious information together with stories. 우리카지노

    ReplyDelete
  36. I admire what you have done here. I like the part where you say you are doing this to give back but I would assume by all the comments that this is working for you as well. https://topnotchchemstore.com

    ReplyDelete
  37. I am glad to be a visitor of this consummate web site! , appreciate it for this rare info ! . Fertility Clinic

    ReplyDelete
  38. I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You. https://topnotchchemstore.com

    ReplyDelete
  39. Hello I am so delighted I located your site, I really located you by mistake, while I was looking on yahoo for something else, Anyways I am here now and could just like to say cheers for a tremendous post and a all round entertaining website. Please do keep up the great work. Mushrooms spores for sale

    ReplyDelete
  40. I admire what you have done here. I like the part where you say you are doing this to give back but I would assume by all the comments that this is working for you as well. ufabet

    ReplyDelete