CFXIXI工作室首页
CF西西的博客 | sencha+phonegap 结合andriod 广告 sdk(试验log)

sencha+phonegap 结合andriod 广告 sdk(试验log)

8. 四月 2012

http://groups.google.com/group/phonegap/browse_thread/thread/6c57e20346ea7695/3d81bf732322e85f

貌似可以做到的,这是构造函数:

 

public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        super.loadUrl("file:///android_asset/www/index.html");
        // Create the adView 
        adView = new AdView(this, AdSize.BANNER, MY_AD_UNIT_ID); 
        LinearLayout layout = super.root; // this is the only change from the sample 
        // Add the adView to it 
        layout.addView(adView); 
        // Initiate a generic request to load it with an ad 
        adView.loadAd(new AdRequest()); 
    }

 

显示效果:(貌似必须是安卓3.2的sdk才能正常显示app)

admob 广告sdk参考文章1:https://developers.google.com/mobile-ads-sdk/docs/android/fundamentals?hl=zh-TW#requirements

参考文章2:(很多网上的教程都是旧版sdk教程,请大家参考2011-11后的教程)

 

注意:1.其后lz试验了admob sdk 4.11的,发现下面的广告条消失了。。。。。。难道只有最新的3.41可以用。。。。

2.lz试验了果合的sdk。。。。。。用上去居然报错噶。。。。。。phonegap遇到异常暂停。。。。

3.最后试验了易传媒的。。。。。居然意料之外的成功了。。。。。。(怎么添加看易传媒sdk)

http://mobile.adchina.com/AboutUs/GetSDK.aspx#

如图:

 

附代码:

 

LinearLayout layout = super.root; // this is the only change from the sample 
        // Add the adView to it 
        AdView view = new AdView(getApplicationContext(),"76502",true,true);
        layout.addView(view); 
        // Initiate a generic request to load it with an ad 
        //adView.loadAd(new AdRequest());

admob, phonegap