如何在Kivy展示广告中使用KIvMob?

2024-10-17 08:37:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正试图把广告放在我的kivy上任命kivmob。 我从kivmobhttp://kivmob.com/下载了这个文档。 我什么都懂,但我不明白我应该补充什么:

self.ads = KivMob()

这是我的全部代码。那么我应该在self.ads=KivMob()所在的行上添加什么呢

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()


Tags: fromimportselfappdefmanagerscreenads
1条回答
网友
1楼 · 发布于 2024-10-17 08:37:12

我也在研究这个话题,我也想在play store上发布我的应用程序

从我的理解到现在

您必须更改以下内容:-

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

使用buildozer.spec文件中的android ndk版本19b构建应用程序

相关问题 更多 >