Android的整合AdWhirl和AdMob [英] Android integration AdWhirl and AdMob

查看:183
本文介绍了Android的整合AdWhirl和AdMob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Andr​​oid应用程序集成AdWhirl和AdMob和我有一些问题:

  1. 我有很多的活动,我想大多数人把广告。在这活动,我应该把下面的code?

    // ** * ADWHIRL code     //这些是与密度无关的像素单元,如在定义     // http://developer.android.com/guide/practices/screens_support.html     INT宽度= 320;     INT高= 52;

      DisplayMetrics displayMetrics = getResources()getDisplayMetrics()。
    浮密度= displayMetrics.density;
    
    宽度=(int)的(宽×密度);
    身高=(INT)(高*密度);
    
    //可选,将在必要时五分钟后获取新的配置。
    AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);
    
    //参考AdWhirlLayout在布局的XML定义的。
    AdWhirlLayout adWhirlLayout =(AdWhirlLayout)findViewById(R.id.adwhirl_layout);
    adWhirlLayout.setAdWhirlInterface(本);
    adWhirlLayout.setMaxWidth(宽);
    adWhirlLayout.setMaxHeight(高度);
    // ******* ADWHIRL code END
     

我已经把这个也code在AndroidManifest:

 <! -  AdWhirl的关键 - >
    <元数据的android:值=7E ********************* 5A6
        机器人:名称=ADWHIRL_KEY/>

    <! -  AdMob的整合 - >
    <活动机器人:名称=com.google.ads.AdActivity
        机器人:configChanges =定位|键盘| keyboardHidden/>
 

  1. 是否有可能始终显示广告的前景,从内容的高度indipendent方式?

有没有人有什么建议?任何帮助是AP preciated。对不起,我的英语水平。

解决方案

虽然code上方是好的,以确保您AdWhirlLayout不会在屏幕尺寸扩大,你不应该需要包括在所有。你可以逃脱包裹AdWhirlLayout您在XML定义内容。您需要然而,在要在显示广告每一项活动的AdWhirlLayout。

要显示在同一个地方广告与内容无关,请考虑使用 RelativeLayout的并使用 机器人:layout_alignParentBottom =真正的属性的AdWhirlLayout分配广告到屏幕的底部,例如:

I'm trying to integrate AdWhirl and AdMob in my Android Application and I have some question:

  1. I have many activities and I want put advertisement in most of them. In which activity should I put the following code?

    //***ADWHIRL CODE // These are density-independent pixel units, as defined in // http://developer.android.com/guide/practices/screens_support.html int width = 320; int height = 52;

    DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
    float density = displayMetrics.density;
    
    width = (int) (width * density);
    height = (int) (height * density);
    
    // Optional, will fetch new config if necessary after five minutes.
    AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);
    
    // References AdWhirlLayout defined in the layout XML.
    AdWhirlLayout adWhirlLayout = (AdWhirlLayout) findViewById(R.id.adwhirl_layout);
    adWhirlLayout.setAdWhirlInterface(this);
    adWhirlLayout.setMaxWidth(width);
    adWhirlLayout.setMaxHeight(height);
    //*******ADWHIRL CODE END
    

I already put also this code in AndroidManifest:

<!-- AdWhirl Key -->
    <meta-data android:value="7e*********************5a6"
        android:name="ADWHIRL_KEY" />

    <!-- AdMob integration -->
    <activity android:name="com.google.ads.AdActivity"
        android:configChanges="orientation|keyboard|keyboardHidden" />

  1. Is it possible show the ads always in the foreground, in a indipendent way from the height of the content?

Does anyone have any advice? Any help is appreciated. Sorry for my English.

解决方案

While the code at the top is nice to make sure your AdWhirlLayout doesn't extend upon the dimensions of the screen, you shouldn't need to include that at all. You could get away with wrapping the content of the AdWhirlLayout you define in XML. You will need to have an AdWhirlLayout in each activity that you want to display ads in, however.

To show your ads in the same place regardless of content, consider using a RelativeLayout and using the android:layout_alignParentBottom="true" property in your AdWhirlLayout to assign the ad to the bottom of the screen, for example.

这篇关于Android的整合AdWhirl和AdMob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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