使用 Google 广告通过 PhoneGap 应用获利(使用 PhoneGap Build 构建) [英] Use Google advertising to monetize PhoneGap app (built with PhoneGap Build)

查看:13
本文介绍了使用 Google 广告通过 PhoneGap 应用获利(使用 PhoneGap Build 构建)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 AdMob 上,不再提供 HTML5 应用选项,以及在 AdSense 上的移动应用程序(甚至那些明确提到的基于 webview 的应用程序)被禁止.

On AdMob, there's no option for HTML5 apps anymore, and on AdSense, mobile apps (even those based on webview, explicitly mentioned) are banned.

如何使用 Google 广告通过 PhoneGap 应用(使用 PhoneGap Build 构建)获利?

How can I use Google advertising to monetize PhoneGap app (built with PhoneGap Build)?

推荐答案

AdMob 插件之前在 PhoneGap Build 中不可用,因为旧政策不允许提交二进制文件.

AdMob plugin was not available in PhoneGap Build before, as the old policy did not allow binary files submitted.

但现在,他们对政策进行了重大更改(http://phonegap.com/blog/2014/12/09/phonegap-build-new-features/),现在允许您使用 Cordova 插件注册表中的插件.

But now, they made a great change to their policy (http://phonegap.com/blog/2014/12/09/phonegap-build-new-features/), and now allow you to use the plugins in Cordova plugin registry.

要在您的应用中使用 Admob 插件,只需在您的 config.xml 中进行配置:

To use Admob plugin in your app, just configure it in your config.xml:

<gap:plugin name="com.google.cordova.admob" source="plugins.cordova.io"/>

要显示横幅广告:

if(AdMob) AdMob.createBanner( {
    adId:admobid.banner, 
    position:AdMob.AD_POSITION.BOTTOM_CENTER, 
    autoShow:true} );

要显示全屏广告:

// preppare and load ad resource in background, e.g. at begining of game level
if(AdMob) AdMob.prepareInterstitial( {adId:admobid.interstitial, autoShow:false} );

// show the interstitial later, e.g. at end of game level
if(AdMob) AdMob.showInterstitial();

更详细的说明和示例代码记录在其 github 项目主页:

More detailed instructions and example code are documented at its github project homepage:

https://github.com/floatinghotpot/cordova-admob-pro

这篇关于使用 Google 广告通过 PhoneGap 应用获利(使用 PhoneGap Build 构建)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆