MichaelStott / KivMob

AdMob support for Kivy
MIT License
145 stars 38 forks source link

Test banner ads not showing #113

Open Sahil-pixel opened 2 years ago

Sahil-pixel commented 2 years ago

I build hello world app with test mode but no test ads showing .

MichaelStott commented 2 years ago

Can you share the logcat output of the android app?

Sahil-pixel commented 2 years ago

code

from kivy.app import App
from kivy.uix.button import Button
from kivmob import KivMob, TestIds
class MyApp(App):
    def build(self):
        self.ads = KivMob(TestIds.APP)
        self.ads.new_banner(TestIds.BANNER, top_pos=True)
        self.ads.request_banner()
        self.ads.show_banner()
        return Button(text="Hello")

MyApp().run() 

adb logs

: [INFO ] [Python ] v3.8.9 (default, Mar 14 2022, 15:35:32) 03-16 13:22:15.920 32277 32306 I python : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462 03-16 13:22:15.921 32277 32306 I python : [INFO ] [Python ] Interpreter at "" 03-16 13:22:18.471 32277 32306 I python : [INFO ] [Factory ] 186 symbols loaded 03-16 13:22:19.188 32277 32306 I python : [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored) 03-16 13:22:19.253 32277 32306 I python : [INFO ] [Text ] Provider: sdl2 03-16 13:22:22.812 32277 32306 I python : [INFO ] [KivMob ] init called. 03-16 13:22:22.812 32277 32306 I python : [INFO ] [KivMob ] Android platform detected. 03-16 13:22:22.815 32277 32306 I python : [INFO ] [KivMob ] new_banner() called. 03-16 13:22:22.823 32277 32306 I python : [INFO ] [KivMob ] request_banner() called. 03-16 13:22:22.826 32277 32306 I python : [INFO ] [KivMob ] show_banner() called. 03-16 13:22:23.099 32277 32306 I python : [INFO ] [Window ] Provider: sdl2 03-16 13:22:23.144 32277 32306 I python : [INFO ] [GL ] Using the "OpenGL ES 2" graphics system 03-16 13:22:23.146 32277 32306 I python : [INFO ] [GL ] Backend used 03-16 13:22:23.147 32277 32306 I python : [INFO ] [GL ] OpenGL version <b'OpenGL ES 3.2 V@269.0 (GIT@368094a, I26dffed9a4) (Date:12/03/17)'> 03-16 13:22:23.147 32277 32306 I python : [INFO ] [GL ] OpenGL vendor <b'Qualcomm'> 03-16 13:22:23.147 32277 32306 I python : [INFO ] [GL ] OpenGL renderer <b'Adreno (TM) 505'> 03-16 13:22:23.148 32277 32306 I python : [INFO ] [GL ] OpenGL parsed version: 3, 2 03-16 13:22:23.148 32277 32306 I python : [INFO ] [GL ] Texture max size <16384> 03-16 13:22:23.148 32277 32306 I python : [INFO ] [GL ] Texture max units <16> 03-16 13:22:23.217 32277 32306 I python : [INFO ] [Window ] auto add sdl2 input provider 03-16 13:22:23.219 32277 32306 I python : [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked 03-16 13:22:23.228 32277 32306 I python : [WARNING] [Base ] Unknown provider 03-16 13:22:23.229 32277 32306 I python : [INFO ] [Base ] Start application main loop 03-16 13:22:23.233 32277 32306 I python : [INFO ] [GL ] NPOT texture support is available

MichaelStott commented 2 years ago

That looks pretty normal. How does your buildozer.spec file look?

MichaelStott commented 2 years ago

Actually, after looking at your code again, you are attempting to show a banner ad immediately after loading the banner ad in the build function of your app. You should have some callback associated with on_click that shows the banner ad only if one has been loaded.

senkux commented 2 years ago

@MichaelStott Actually I did..... But still ads ain't showing.

callumpurcell1 commented 9 months ago

2 years on I know but I've got the same issue. App compiles fine but doesn't show the test banner ad.

buildozer.spec file (relevant parts):

requirements = python3,kivy,sqlite3,kivymd==1.2.0,kivmob

android.permissions = android.permission.INTERNET, (name=android.permission.WRITE_EXTERNAL_STORAGE;maxSdkVersion=18), ACCESS_NETWORK_STATE

android.api = 33

android.minapi = 21

android.sdk = 33

android.ndk = 25b

android.gradle_dependencies = com.google.firebase:firebase-ads:21.4.0

android.enable_androidx = True

in my main.py file:

from kivymob import KivMob, TestIds

    ads = KivMob("ca-app-pub-3940256099942544~3347511713")
    def build(self):
        self.ads.new_banner(TestIds.BANNER, False)
        self.ads.request_banner()
        self.ads.show_banner()

I tried to look at the logs but when I run buildozer android debug deploy run logcat it instantly prints a load of gibberish to the console, which means I can't read the logs.

Is there something I'm doing wrong? I downloaded kivmob through Pycharm. I know above it's mentioned to have a callback after on_click to load the ad but surely that isn't needed as I want the ad to appear as the user loads the first page, I don't want them to have to click a button to see the ad.