用于 webos/palm 的 admob

发布于 2024-09-06 11:07:05 字数 96 浏览 3 评论 0原文

我想将 admob 广告集成到我的 palm pre 应用程序中。您能否建议我并分享广告的集成代码。我发现一些代码对我不起作用,

提前感谢

阿斯旺

i want integrate admob ads to my palm pre application.can you please suggest me and share integration code for ads.some where i found code it wont work for me

Thanks in Advance

Aswan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅笑轻吟梦一曲 2024-09-13 11:07:05

首先,在admob 注册一个帐户。创建新应用程序 转到“站点和应用程序”,然后单击“添加站点/应用程序” 填写信息。完成后,您应该能够转到“站点和应用程序”选项卡并单击“站点和应用程序”。这将显示您所有应用程序的列表。将鼠标悬停在您刚刚填写的应用程序上,然后单击“管理设置”。在那里,您应该可以找到您的发布商 ID。保存起来。您稍后会需要它。

下载 admob.js 文件

然后,通过此链接在您的来源中 .json file add {"source": "app/admob.js"}

确保该路径是您的 admob.js 文件所在的位置。在本例中,它位于我的 /app 文件夹中。

然后,转到要显示广告的场景的 setup() 函数。添加以下代码:AdMob.ad.initialize({
pub_id: 'aaaaaaaaaaaaa',
bg_color: '#ccc',
文本颜色: '#333',
测试模式:真
});

将 pub_id 参数替换为第一步中您的发布商 ID。颜色应该是不言自明的。当您设置广告时,请将 test_mode 设置为 true。在发布应用程序之前将其关闭。

然后,转到要添加的场景的视图文件。添加一个 .将其命名为“admob_ad”

<div id = "admob_ad"></div>

现在是最后一步。调用它来实际发出请求:

AdMob.ad.request({
            onSuccess: (function (ad) { 
                    this.controller.get('admob_ad').insert(ad); 
            }).bind(this),
            onFailure: (function () { 

            }).bind(this),

    });

现在,通常您将在设置方法中发出广告请求,因为您只会在场景加载时加载应用程序。 Admob 对于刷新广告的频率有规定,所以要小心。

现在,当您运行此程序时,您应该会看到其中一个 Admob 横幅,上面写着“admob 测试消息”之类的内容。一旦你让它工作并准备好发布你的应用程序,请在你的设置调用中关闭 test_mode 。请记住,一旦执行此操作,广告就不会 100% 被填充。

First, make an account at admob. Create a new app Go to "sites and apps" and click "add site/app" Fill out the information. Once you are done, you should be able to go to the "sites and app" tab and click "sites and apps". This brings up a list of all your apps. Hover over the app you just filled out and click "manage settings". There, you should find your publisher ID. Save it. You will need it later.

Then, download the admob.js file at this link

In your sources.json file add {"source": "app/admob.js"}

Make sure the path is where your admob.js files is located at. In this case, its in my /app folder.

Then, go to the setup() function of the scene where you want to display the ad. Add the following code: AdMob.ad.initialize({
pub_id: 'aaaaaaaaaaaaaa',
bg_color: '#ccc',
text_color: '#333',
test_mode: true
});

Replace the pub_id parameter with your publisher ID from the first step. The colors should be self explanatory. When you are setting up your ads, have test_mode to true. TURN IT OFF BEFORE YOU SHIP YOUR APP.

Then, go to the view file of the scene where you want the add. Add a . Call it "admob_ad"

<div id = "admob_ad"></div>

Now, the final step. Call this to actually make the request:

AdMob.ad.request({
            onSuccess: (function (ad) { 
                    this.controller.get('admob_ad').insert(ad); 
            }).bind(this),
            onFailure: (function () { 

            }).bind(this),

    });

Now, usually you will will make the ad request in your setup method, as you will only load an app when the scene loads. Admob has rules as to how often you should refresh ads, so be careful.

Now, when you run this, you should get one of those admob banners that says something like "admob test messages". Once you have it working and are ready to ship your app, turn off test_mode in your setup call. Keep in mind that once you do this, the ad will not be filled 100% of the time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文