Original library: https://developers.facebook.com/docs/audience-network/guides/adding-sdk/android
Based on Android Audience Network SDK 6.5.0 (17 May 2021)
Banner, Interstitial and Rewarded Video.
Library does not work anymore as Facebook ads must be served thorough mediation partners.
More info HERE.
For InterstitialAd and for RewardedVideoAd you need to add this in your manifest:
Download library zip file from this link and extract archive to Additional Libraries folder. I'm not able to upload on forum, as size of file is over maximum allowed limit.
v6.00 - Manifest code changed.
v0.98+ - bring some breaking changes on Initialize method to support CCPA. Please check country and state parameters on Facebook (data processing options for CCPA)
Based on Android Audience Network SDK 6.5.0 (17 May 2021)
Banner, Interstitial and Rewarded Video.
Library does not work anymore as Facebook ads must be served thorough mediation partners.
More info HERE.
FBAudienceNetworkAds
Author: Author: Facebook - B4a Wrapper: Pendrush
Version: 6.50
- FBAudienceNetworkBanner
- Events:
- AdClicked
- AdError (Error As String)
- AdLoaded
- AdLoggingImpression
- Fields:
- AD_BANNER_HEIGHT_50 As Object
Banner - 50dip height, you need to set parent view height to 50dip- AD_BANNER_HEIGHT_90 As Object
Banner - 90dip height, you need to set parent view height to 90dip- AD_RECTANGLE_HEIGHT_250 As Object
Rectangle - 250dip height, you need to set parent view height to 250dip- Functions:
- BringToFront
- DestroyAd
Destroy Ad- Initialize (arg1 As String)
- InitializeBanner (EventName As String, PlacementId As String, Country As Int, State As Int, BannerAdSize As com.facebook.ads.AdSize)
Initialize Banner Ad
AdBanner.InitializeBanner("AdBanner", "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID", 0, 0, AdFacebook.AD_BANNER_HEIGHT_50)
Activity.AddView(AdBanner, 0, 0, 100%x, 50dip)
AdBanner.LoadAd- Invalidate
- Invalidate2 (arg0 As android.graphics.Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- LoadAd
Load Ad- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As android.graphics.Bitmap) As BitmapDrawable
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- Properties:
- Background As android.graphics.drawable.Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Padding As Int()
- Parent As Object [read only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- FBAudienceNetworkInterstitial
- Events:
- AdClicked
- AdDismissed
- AdDisplayed
- AdError (Error As String)
- AdLoaded
- AdLoggingImpression
- Functions:
- DestroyAd
Destroy Ad.- InitializeInterstitialAd (EventName As String, PlacementId As String, Country As Int, State As Int)
Initialize Interstitial Ad
AdInterstitial.InitializeInterstitialAd("AdInterstitial", "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID", 0, 0)
AdInterstitial.LoadAd- IsAdInvalidated As Boolean
Check if Ad is already expired or invalidated,
and do not show Ad if that is the case.
You will not get paid to show an invalidated Ad.- IsAdLoaded As Boolean
Check if Ad is loaded.- IsInitialized As Boolean
- LoadAd
Load Ad.- ShowAd
Show Ad.- FBAudienceNetworkRewardedVideo
- Events:
- AdClicked
- AdError (Error As String)
- AdLoaded
- AdLoggingImpression
- AdRewardedVideoClosed
- AdRewardedVideoCompleted
- Functions:
- DestroyAd
Destroy Ad.- InitializeRewardedVideoAd (EventName As String, PlacementId As String, Country As Int, State As Int)
Initialize Rewarded Video Ad
AdRewardedVideo.InitializeRewardedVideoAd("AdRewardedVideo", "VID_HD_16_9_15S_LINK#YOUR_PLACEMENT_ID", 0, 0)
AdRewardedVideo.LoadAd- IsAdInvalidated As Boolean
Check if Ad is already expired or invalidated,
and do not show Ad if that is the case.
You will not get paid to show an invalidated Ad.- IsAdLoaded As Boolean
Check if Ad is loaded.- IsInitialized As Boolean
- LoadAd
Load Ad.- ShowAd
Show Ad.
For InterstitialAd and for RewardedVideoAd you need to add this in your manifest:
B4X:
AddApplicationText(<activity
android:name="com.facebook.ads.AudienceNetworkActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<provider
android:name="com.facebook.ads.AudienceNetworkContentProvider"
android:authorities="${applicationId}.AudienceNetworkContentProvider"
android:exported="false" />)
Download library zip file from this link and extract archive to Additional Libraries folder. I'm not able to upload on forum, as size of file is over maximum allowed limit.
v6.00 - Manifest code changed.
v0.98+ - bring some breaking changes on Initialize method to support CCPA. Please check country and state parameters on Facebook (data processing options for CCPA)
Attachments
Last edited: