N Sivaram
N Sivaram

Reputation: 298

How to use KIvMob in Kivy displaying ads?

I am currently trying to put ads on my kivy apposing kivmob. I red this documentation from kivmob http://kivmob.com/. I understood everything but I cannot understand what I should add on:

self.ads = KivMob()

This is my full code. So what should I add on the line where self.ads = KivMob() is

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen,NoTransition,CardTransition
from kivy.uix.button import ButtonBehavior
from kivy.uix.image import Image
from kivy.uix.label import Label
from functools import partial
import requests
import json
from os import walk
from kivmob import KivMob, TestIds

class MainApp(App):
    # me = 1

    def build(self):
        return GUI

    def on_start(self):
        self.ads = KivMob( ) # so what should I add here
        self.ads.new_banner("ca-app-pub-3940256099942544~3347511713", top_pos=True)
        self.ads.request_banner()
        self.ads.show_banner()



    def change_screen(self,screen_name):
        # get the screen manager from the kv file
        screen_manager = self.root.ids['screen_manager']
        screen_manager.current = screen_name
        # screen_manager = self.root.ids



MainApp().run()

Upvotes: 1

Views: 1688

Answers (1)

Abhay Gupta
Abhay Gupta

Reputation: 90

I am also researching on this topic i also want to pubish my app on play store.

From my understanding till now.

you have to change the following:-

self.ads = kivmob(YOUR_APP_ID)  /*you are provided with an app id when you sign up on 
                                  google admob. Paste that id here */

self.ads.new_banner("ca-app-pub-3940256099942544~3347511713", top_pos=True) #This is OK!

self.ads.request_banner()       #add this line for requesting banner ad
self.ads.show_banner()          # Finally Show the banner

Use android ndk version 19b in buildozer.spec file to build your app.

Upvotes: 1

Related Questions