This library creating for easy to use Admob & Facebook ads easily. You can load & show Admob or Facebook ads once code easily. You can't control ads click listener here. This library just shows your ads perfectly in an easy way.
1> Add into settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url 'https://jitpack.io' }
}
}
2> Add into build.gradle (Module :app)
dependencies {
implementation 'com.github.sdshafiq01:Admob-Facebook-Mediation-Implements:1.1.01'
}
3> Intit Google Admob GDPR
AdsGDPR adsGDPR = new AdsGDPR(act);
4> Add Banner layout into XML
// add this layout into the activity.xml or fragment.xml file. you can set 2 types of ads here => banner ads / native ads
<RelativeLayout
android:id="@+id/adsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" />
5> Add into java
// init ads
InitAds.selectAds(act);
// init banner ads layout
RelativeLayout adsLayout = findViewById(R.id.adsLayout);
//if Admob ads are not loaded then automatically load Facebook banner ads
BannerAdsAdapter.bannerAdmob(act, adsLayout, Constant.ADS_SELECT_FACEBOOK, Constant.ADMOB_TEST_BANNER_ID, Constant.FB_TEST_BANNER_FACEBOOK_ID);
//if Facebook ads are not loaded then automatically load Admob banner ads
BannerAdsAdapter.bannerFacebook(act, adsLayout, Constant.ADS_SELECT_ADMOB, Constant.ADMOB_TEST_BANNER_ID, Constant.FB_TEST_BANNER_FACEBOOK_ID);
//If Admob ads are not loaded then automatically load Facebook interstitial ads
InterstitialAdsAdapter.loadInterstitialAdmob(act, Constant.ADS_SELECT_FACEBOOK, Constant.ADMOB_TEST_INTERSTITIAL_ID, Constant.FB_TEST_INTERSTITIAL_ID);
//If Facebook ads are not loaded then automatically load Admob interstitial ads
InterstitialAdsAdapter.loadInterstitialFacebook(act, Constant.ADS_SELECT_ADMOB, Constant.FB_TEST_INTERSTITIAL_ID, Constant.ADMOB_TEST_INTERSTITIAL_ID);
// Check whether Interstitial Ads is loaded or not. if any one ad loaded then it shows automatically
if(InterstitialAdsAdapter.isAdsLoaded()){
InterstitialAdsAdapter.showInterstitial(act);
}
//If Admob ads are not loaded then automatically load Facebook Rewards ads
RewardsAdsAdapter.loadRewardsAdmob(act, Constant.ADS_SELECT_FACEBOOK, Constant.ADMOB_TEST_REWARDS_ID, Constant.FB_TEST_REWARDS_ID);
//If Facebook ads are not loaded then automatically load Admob Rewards ads
RewardsAdsAdapter.loadRewardsFacebook(act, Constant.ADS_SELECT_ADMOB, Constant.FB_TEST_REWARDS_ID, Constant.ADMOB_TEST_REWARDS_ID);
// Check whether Rewards Ads is loaded or not. if any one ad loaded then it shows automatically
if (RewardsAdsAdapter.isAdsAvailable()){
RewardsAdsAdapter.showAds(act);
}
////////////////////////////////////
// load Admob big or small Size Native Ads, if not loaded Admob ads then auto load Facebook big or small size native ads.
NativeAdsAdapter.loadNativeAdmob(act, adsLayout, Constant.ADS_SELECT_FACEBOOK, Constant.ADMOB_TEST_NATIVE_ID, Constant.FB_TEST_NATIVE_ADS_ID, Constant.BIG_NATIVE_ADS);
// load Facebook Big Size Native Ads, if not loaded Admob ads then auto load Admob big-size native ads.
NativeAdsAdapter.loadBigFacebookNative(act, adsLayout, Constant.ADS_SELECT_ADMOB, Constant.FB_TEST_NATIVE_ADS_ID, Constant.ADMOB_TEST_NATIVE_ID);
// load Facebook Small Size Native Ads, if not loaded Admob ads then auto load Admob small-size native ads.
NativeAdsAdapter.loadSmallFacebookNative(act, adsLayout, Constant.ADS_SELECT_ADMOB, Constant.FB_TEST_NATIVE_BANNER_ID, Constant.ADMOB_TEST_NATIVE_ID);
For feature requests, improvements, questions, or any other integration issues using Admob Facebook Mediation Library, then contact us via email:
techharvestbd@gmail.com