Use Google advertising to monetize PhoneGap app (built with PhoneGap Build)

穿精又带淫゛_ 提交于 2019-12-18 11:54:11

问题


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

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


回答1:


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

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.

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" />

To display a banner Ad:

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

To display a full screen Ad:

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

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

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




回答2:


PhoneGap builds native apps, so you'll have to use the Native AdMob SDK. There are guides on the web on how to do AdMob native implementation. But if you're more into plugins, check out the AdMob plugin for Cordova (Android | iOS).



来源:https://stackoverflow.com/questions/13485212/use-google-advertising-to-monetize-phonegap-app-built-with-phonegap-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!