Comments (3)
Hi, are you trying to set an ad size manually?
from godot-admob-android.
I'm not changing the ad size manually.
Here are the only scripts that interact with the addon in my code:
extends Control
var ad_view : AdView
signal ad_loaded
func _ready():
#The initializate needs to be done only once, ideally at app launch.
MobileAds.initialize()
create_ad_view()
func create_ad_view() -> void:
print("create_ad_view")
var ad_switch = get_node("GameAdSwitch")
if ad_switch.are_ads_enabled():
if ad_view:
destroy_ad_view()
var unit_id = ad_switch.get_ad_unit_id()
ad_view = AdView.new(unit_id, AdSize.FULL_BANNER, AdPosition.Values.BOTTOM)
register_ad_listener()
var ad_request := AdRequest.new()
ad_view.load_ad(ad_request)
func destroy_ad_view() -> void:
print("destroy_ad_view")
if ad_view:
#always call this method on all AdFormats to free memory on Android/iOS
ad_view.destroy()
ad_view = null
func register_ad_listener() -> void:
print("register_ad_listener")
if ad_view != null:
print("ad_view not null")
var ad_listener := AdListener.new()
ad_listener.on_ad_failed_to_load = func(load_ad_error : LoadAdError) -> void:
print("_on_ad_failed_to_load: " + load_ad_error.message)
ad_listener.on_ad_clicked = func() -> void:
print("_on_ad_clicked")
ad_listener.on_ad_closed = func() -> void:
print("_on_ad_closed")
ad_listener.on_ad_impression = func() -> void:
print("_on_ad_impression")
ad_listener.on_ad_loaded = func() -> void:
print("_on_ad_loaded")
print(ad_view.get_width(), ' ', ad_view.get_height())
print(ad_view.get_width_in_pixels(), ' ', ad_view.get_height_in_pixels())
ad_loaded.emit()
ad_listener.on_ad_opened = func() -> void:
print("_on_ad_opened")
ad_view.ad_listener = ad_listener
And also this one:
extends MarginContainer
# Called when the node enters the scene tree for the first time.
func _ready():
visibility_changed.connect(_update_size)
var ad_holder = get_node("/root/GameRootNode/Ad_holder")
ad_holder.ad_loaded.connect(_update_size)
func _on_visibility_changed():
#print("_on_visibility_changed")
_update_size.call_deferred()
func _update_size():
#print("_update_size")
#var ad_holder = get_tree().get_root().find_child("Ad_holder")
var ad_holder = get_node("/root/GameRootNode/Ad_holder")
if ad_holder.ad_view:
self.custom_minimum_size.x = ad_holder.ad_view.get_width_in_pixels()
self.custom_minimum_size.y = ad_holder.ad_view.get_height_in_pixels()
else:
self.custom_minimum_size.x = 0
self.custom_minimum_size.y = 0
from godot-admob-android.
I have created a PR that solves this issue:
#233
from godot-admob-android.
Related Issues (20)
- An Error when i change the test App-ID in the manifest HOT 1
- Just question HOT 4
- Parse Error: Function "get_plugin_version()" not found in base self. HOT 2
- Update for godot 4.2.0 stable HOT 7
- Provide Custom Export Template HOT 2
- v2.1.6 crashing without error HOT 3
- Rewarded ads not working or delayed HOT 1
- impression level ad revenue HOT 2
- Ad compatibility problem with devices HOT 7
- Admob android plugin shows black screen when enabled on Android API level 30
- Admob android plugin shows black screen when enabled on Android API level 30 HOT 2
- Families Policy Requirements HOT 2
- [FEATURE] Verify a new release version every day to release a new build
- TOP Banner Ad position is leaving a wide gap HOT 8
- Action required: Migrate to a supported version of the Google Play Billing Library HOT 2
- PoingGodotAdMob not found
- PoingGodotAdMobAdColonyAppOptions not found
- Potential memory leak (?) HOT 2
- LTS for Godot 3.x til Godot 4 is mature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot-admob-android.