Categories

Follow Us @web_learners

Monday, May 18, 2020

Facebook Native Banner Ads Integration in Android App | Admob Alternative Ad network

May 18, 2020 2 Comments
Hi, Today I am going to show you How to integrate Facebook Native Banner Ads in Android App. In the last post, I have shown you how to integrate Facebook Banner Ads in Android App. Let's start.


First, add the below dependency in build.gradle(Module: App) for importing Facebook ads SDK.


Code:




And then move to the activity_main.xml file, then paste the below layout code.




Code:


It will show your ad bottom of the screen if you want to show your ad Top of the screen you need to write android:layout_alignParentBottom="true". 

Then you have to create a new layout for your Native Banner Ad, named it native_banner_ad_layout.xml 



Then paste the below code in native_banner_ad_layout.xml file.


Code:


So the final full code will be in activity_main.xml file is as follows:


Code:





Now move to the MainActivity.java file, first import the Facebook ads SDK write the following code.


Code:


Then paste the below code above Oncreate.


Code:


Now initialize the Facebook SDK in Oncreate.

Code:


Then create NativeBannerAd object, set an AdListener, then retrieve the "Native Banner Ad's" properties and display it in onAdLoaded() method. It will display the ad once it is loaded successfully. After that call loadAd() after AdListener in your Activity as follows.



Code:


Then paste the following code in your activity after Oncreate.


Code:


So the final code will be in your java activity file is as follows:



Code:


Now if you run your App you will see the Native Banner ad.





That's it. Thank you.

Sunday, May 17, 2020

Facebook Interstitial Ads Integration in Android App | Admob Alternative Ad network

May 17, 2020 0 Comments
Hi, Today I am going to show you How to integrate Facebook Interstitial Ads in the Android app.
In the next post, I will show you How to integrate Facebook Native banner Ads in the Android app.


First, add the below dependency in build.gradle(Module: App) for importing Facebook ads SDK.


Code:




And then move to the MainActivity.java file, take an InterstitialAd variable called interstitialAd.





After that, you have to initialize the SDK in Oncreate.








And then need to initialize that  InterstitialAd variable with your Interstitial Placement ID. Then load an ad.


Code:


Then you can setAdListener and call interstitialAd.show for showing your Interstitial Ad.


Code:




Then you call loadad() for loading an interstitial ad.



That's it. After publishing your app in the google play store, you will see your Interstitial ad is showing in your app. Thank you.

Wednesday, May 13, 2020

How to Make images fit in all Screen Sizes | Webview App Development Series Part 15

May 13, 2020 0 Comments
Hi, Last post I have shown you How to Make Android App or Webview App fit all Screen Sizes. Today I am going to show you How to Make images fit in all Screen Sizes. Let's Start.



Usually, the display of mobile devices becomes small, normal, large, x-large. For fitting all these screen sizes, you need to also give these sizes of images. For doing this I will use the software, you can Download image Resizer


In the software First, you have to select the size format from the left side, such as mdpi, hdpi, xhdpi, tvdpi etc. then you need to select drawable from the drop-down menu. 

And then have to select the destination where you want to save the picture. And then drop your image. After resizing copy all the image folder and paste it in the drawable folder in Android studio. Please watch the above video and follow my step.