Facebook Ads Integration
Features
- Interstitial
- Banner
- Native
- Native Banner
Step 1. Add the JitPack repository to your build fileallprojects { repositories {
maven { url 'https://jitpack.io' } } }
Step 2. Add the dependency
dependencies { implementation 'com.github.vocsyinfotech:VocsyFacebookAds:0.1.4' }
// LOAD FACEBOOK Interstitial
facebookInterstitial = new FacebookInterstitial(this, getString(R.string.facebook_interstitialAd_id));
facebookInterstitial.loadInterstitialAds(new FacebookInterstitial.ActionListener() {
@Override
public void performAction() {
// do here your action after Facebook Ads Closed
}
});
// SHOW FACEBOOK Interstitial
facebookInterstitial.ShowinterstitialAd(this);
// SHOW FACEBOOK Interstitial END
<LinearLayout
android:id="@+id/banner_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent" />
FacebookBanner.FacebookBannerNormal(this, findViewById(R.id.banner_container), getString(R.string.facebook_banner_id));
you can use also
FacebookBanner90
FacebookBanner250
<com.facebook.ads.NativeAdLayout
android:layout_marginTop="50dp"
android:id="@+id/native_ad_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
FacebookNative.FacebookNativeNormal(this, findViewById(R.id.native_ad_container), getString(R.string.facebook_native_id));
you can use also
FacebookNativeSmall
FacebookNativeBanner
<com.facebook.ads.NativeAdLayout
android:layout_marginTop="50dp"
android:id="@+id/native_banner_ad_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
FacebookNative.FacebookNativeBanner(this, findViewById(R.id.native_banner_ad_container), getString(R.string.facebook_native_banner_id));