Code below.
local function adListener_FB( event )
– Successful initialization of the Facebook Audience Network
if ( event.phase == “init” ) then
print( "Facebook Audience Network event: initialization successful with placementID: " … placementID )
fbAudienceNetwork.load( “banner”, placementID, “BANNER_HEIGHT_50” )
– An ad loaded successfully
elseif ( event.phase == “loaded” ) then – The ad was successfully loaded
print( event.type )
print( event.placementId )
– Show the ad
fbAudienceNetwork.show( event.type, event.placementId, {y = screenH - 50}) – { yAlign=“bottom” } )
transition.to (tabBar, { time=200, y = screenH - 75} )
print(“Facebook Ad loaded Successfully.”)
elseif ( event.phase == “failed” ) then – The ad failed to load
print( event.type )
print( event.placementId )
print( event.isError )
print( event.response )
– show admob ad
fbAudienceNetwork.hide( placementID )
adType = “admob”
showAd();
elseif ( event.phase == “clicked” ) then – The ad was clicked/tapped
print( event.type )
print( event.placementId )
elseif ( event.phase == “closed” ) then – The ad was closed (interstitial ads only)
print( event.type )
print( event.placementId )
end
end
function initAds ()
– for Facebook Audience Network
if isAndroid then
placementID = FBbannerPlacementID_android
else
placementID = FBbannerPlacementID_iOS
end
local deviceHashID_junhyuniPhone6s = “4f1613XXXXXXXXXXXee092b91”
fbAudienceNetwork.init( adListener_FB )
end
current device console message
I/Corona ( 1206): Facebook Audience Network event: initialization successful with placementID: 58084XXXXXXXXXX8729981
I/Corona ( 1206): banner
I/Corona ( 1206): 580840XXXXXXXXXXXXX8729981
I/Corona ( 1206): Facebook Ad loaded Successfully.