Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

frankjardel/GodotFAN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

37 Commits

Repository files navigation

Facebook Audience Network GODOT Plugin compatible with godot >= 3.2.1 new plugin system

Facebook SDK Version

[dependencies]

api ('androidx.annotation:annotation:1.0.0')

api ('com.facebook.android:audience-network-sdk:6.+')

Config

autoload-facebook-ads

Using the plugin

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

Initialize the module

in your project.godot add

[android]
modules="org/godotengine/godot/GodotFAN"

or From Project Setting >> Compression > Android register-modules

API

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")

Calling the interstitial and rewarded video ads

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 

CallBacks

#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

Debugging

adb -d logcat GodotFan:V FAN:V godot:V *:S

Tested with godot 3.4

demo

About

Facebook Audience Network Ad module for godot

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 83.2%
  • GDScript 16.8%

AltStyle によって変換されたページ (->オリジナル) /