Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am not able to make interstitial and rewarded video ads work #97

Open
ekingunoncu opened this issue Jul 16, 2019 · 3 comments
Open

I am not able to make interstitial and rewarded video ads work #97

ekingunoncu opened this issue Jul 16, 2019 · 3 comments
Labels

Comments

@ekingunoncu
Copy link

Hello!

I build my game for android. My Godot version is 3.1.
Firstly, thanks a lot for your efforts.
I have an Issue. I don't know if I am doing something stupid but when I build the game I can see banner ads but not interstitial and rewarded ones.

I am using these Test Ids below:
var adInterstitialId = "ca-app-pub-3940256099942544/1033173712"
var adRewardedId = "ca-app-pub-3940256099942544/5224354917"

I made an object(node as gd script) named Admob
`extends Node

var admob = null
var isReal = false
var isTop = true
var adBannerId = "ca-app-pub-3940256099942544/6300978111"
var adInterstitialId = "ca-app-pub-3940256099942544/1033173712"
var adRewardedId = "ca-app-pub-3940256099942544/5224354917"
var mainScene = load("res://scenes/MainScene.tscn")

func _init():
if(Engine.has_singleton("AdMob")):
admob = Engine.get_singleton("AdMob")
admob.init(isReal, get_instance_id())

func connectToResize(tree):
tree.connect("screen_resized", self, "onResize")

func loadBanner():
if admob != null:
admob.loadBanner(adBannerId, isTop)

func loadInterstitial():
if admob != null:
admob.loadInterstitial(adInterstitialId)

func loadRewardedVideo():
if admob != null:
admob.loadRewardedVideo(adRewardedId)

Events

func _on_BtnBanner_toggled(pressed):
if admob != null:
if pressed: admob.showBanner()
else: admob.hideBanner()

func _on_BtnInterstitial_pressed():
if admob != null:
admob.showInterstitial()

func _on_BtnRewardedVideo_pressed():
if admob != null:
admob.showRewardedVideo()

func _on_admob_network_error():
print("Network Error")

func _on_admob_ad_loaded():
print("Ad loaded success")
get_node("CanvasLayer/BtnBanner").set_disabled(false)

func _on_interstitial_not_loaded():
print("Error: Interstitial not loaded")

func _on_interstitial_loaded():
print("Interstitial loaded")
get_node("CanvasLayer/BtnInterstitial").set_disabled(false)

func _on_interstitial_close():
print("Interstitial closed")
get_node("CanvasLayer/BtnInterstitial").set_disabled(true)

func _on_rewarded_video_ad_loaded():
print("Rewarded loaded success")
get_node("CanvasLayer/BtnRewardedVideo").set_disabled(false)

func _on_rewarded_video_ad_closed():
print("Rewarded closed")
get_node("CanvasLayer/BtnRewardedVideo").set_disabled(true)
loadRewardedVideo()

func _on_rewarded(currency, amount):
print("Reward: " + currency + ", " + str(amount))
get_node("CanvasLayer/LblRewarded").set_text("Reward: " + currency + ", " + str(amount))

Resize

func onResize():
if admob != null:
admob.resize()
`

When I initialize Admob object and call the methods in my opening scene for Banner everything works fine but with the same logic other ads doesn't working.

works:
admob.connectToResize(get_tree())
admob.loadBanner()

not working:
admob.connectToResize(get_tree())
admob.loadInterstitial()

admob.connectToResize(get_tree())
admob.loadRewardedVideo()

@juliohq
Copy link

juliohq commented Aug 12, 2019

I had the same problem. For some reason, it was being caused by the portrait/landscape.

@yamshing
Copy link

@ekingunoncu I think you forget to call loadBanner(), loadInterstitial(), loadRewardedVideo after admob.init(isReal...) in func _init. Like this https://github.com/kloder-games/godot-admob/blob/master/examples/godot-3/main.gd#L14

@gumaciel
Copy link
Collaborator

gumaciel commented May 5, 2020

This issue still persists? @ekingunoncu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants