[dependencies]
api ('androidx.annotation:annotation:1.0.0')
api ('com.facebook.android:audience-network-sdk:6.+')
clone or download the repo to your and place GodotFAN folder to your_godot_project/android folder , after installing Android Build Template
the new Godot plugin system doesn't require compiling the source code
in your project.godot add
[android]
modules="org/godotengine/godot/GodotFAN"
or From Project Setting >> Compression > Android register-modules
var facebookAds func _ready()-> void: facebookAds = Engine.get_singleton("GodotFAN") facebookAds.FacebookAdsInit(get_instance_id(),"YOUR_INTERSTITIAL_PLACEMENT_id","YOUR_REWARDED_VIDEO_PLACEMENT_id" , "YOUR_BANNER_PLACEMENT_id")
facebookAds.showInterstitial() #Calls an interstitial ad facebookAds.loadRewardedVideo() # Loads a rewardedVideo ad facebookAds.showRewardedVideo() #Calls a rewarded video ad (remmember to call loadRewardedVideo() before showing a rewarded video) facebookAds.loadBanner(isTop : bool) #Loads a banner AdView , it takes a bool parameter , true for banner in the TOP , false for a banner in the BOTTOM facebookAds.showBanner() #show a banner ad if it is hidden , the banner ad is by visible by default facebookAds.hideBanner() #hide a banner ad , the banner ad is by visible by default
#Interstitial Ad CallBacs func onInterstitialReady() -> void: #Called When a interstitial Ad is loaded and Ready pass func onInterstitialClosed() -> void: #Called When a interstitial Ad is closed pass ##Rewarded Video Ad CallBacs func onRewardedReady() -> void: #Called When a Rewarded video Ad is loaded and ready pass func onRewardedClosed() -> void: #Called When a Rewarded video Ad is closed (completed or not , this only detects the close action) pass func onRewardedCompleted() -> void: #Called When An Rewarded video Ad is completed #Call Reward Function here pass
adb -d logcat GodotFan:V FAN:V godot:V *:S
Tested with godot 3.4