使用谷歌的广告来赚钱的PhoneGap应用程序(建成的PhoneGap构建)应用程序、广告、PhoneGap

2023-09-08 18:48:59 作者:拥欢

在AdMob的,有对HTML5的应用程序没有选择了,而在AdSense,移动应用程序(即使是那些基于web视图,明确提及)被禁止。

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

如何使用谷歌的广告来赚钱的PhoneGap应用程序(建成的PhoneGap构建)?

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

推荐答案

AdMob的插件是不可用的PhoneGap构建之前,为旧的政策并不允许提交的二进制文件。

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/ ),现在允许您使用在科尔多瓦插件注册表中的插件。

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:

<差距:插件名称=com.google.cordova.admob来源=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();

更详细的说明和举例code都记录在它的github上的项目主页:

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

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