我实施了 Adwhirl,但没有广告出现
下面是我在其中添加我的 AdWhirl 布局的线性布局的 xml 代码:
<LinearLayout
android:id="@+id/ll_ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
>
</LinearLayout>
下面是我创建 Adwhril 布局并将其添加到 LinearLayout“ll_ad”的代码:
AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);
AdWhirlTargeting.setAge(23);
AdWhirlTargeting.setGender(AdWhirlTargeting.Gender.MALE);
AdWhirlTargeting.setKeywords("online games gaming");
AdWhirlTargeting.setPostalCode("94123");
AdWhirlTargeting.setTestMode(false);
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this,
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
int diWidth = 320;
int diHeight = 52;
float density = getResources().getDisplayMetrics().density;
adWhirlLayout.setAdWhirlInterface(this);
adWhirlLayout.setMaxWidth((int) (diWidth * density));
adWhirlLayout.setMaxHeight((int) (diHeight * density));
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
LinearLayout layout = (LinearLayout) findViewById(R.id.ll_ad);
layout.setGravity(Gravity.CENTER_HORIZONTAL);
layout.addView(adWhirlLayout, layoutParams);
layout.invalidate();
以下是 logcat 消息:
09-05 23:09:39.055: I/AdWhirl SDK(278): Creating adWhirlManager...
09-05 23:09:39.055: D/AdWhirl SDK(278): Locale is: en_US
09-05 23:09:39.105: D/AdWhirl SDK(278): Hashed device ID is: XXXXXXXXXXXXXXXXXXXXXXXXXXX
09-05 23:09:39.105: I/AdWhirl SDK(278): Finished creating adWhirlManager
09-05 23:09:39.154: D/AdWhirl SDK(278): Prefs{xxxxxxxxxxxxxxxxxxxxxxxx}: {"config": "{"extra":{"location_on":1,"background_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"text_color_rgb":{"red":0,"green":0,"blue":0,"alpha":1},"cycle_time":30,"transition":8},"rations":[{"nid":"xxxxxxxxxxxxxxxxxxxxx","type":20,"nname":"zestadz","weight":50,"priority":2,"key":"xxxxxxxxxxxxxxxxxxxxxxxx"},{"nid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","type":1,"nname":"admob","weight":50,"priority":1,"key":"xxxxxxxxxxxxxxxxxxxxxx"}]}
09-05 23:09:39.154: D/AdWhirl SDK(278): ", "timestamp": 1346886053654}
09-05 23:09:39.164: I/AdWhirl SDK(278): Stored config info not present or expired, fetching fresh data
09-05 23:09:39.284: D/AdWhirl SDK(278): HTTP/1.1 200 OK
09-05 23:09:39.304: D/AdWhirl SDK(278): Received jsonString: {"extra":{"location_on":1,"background_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"text_color_rgb":{"red":0,"green":0,"blue":0,"alpha":1},"cycle_time":30,"transition":8},"rations":[{"nid":"xxxxxxxxxxxxxxxxxxxxxxxx","type":20,"nname":"zestadz","weight":50,"priority":2,"key":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},{"nid":"xxxxxxxxxxxxxxxxxxxxxxxxx","type":1,"nname":"admob","weight":50,"priority":1,"key":"xxxxxxxxxxxxxxxxxxxx"}]}
09-05 23:09:39.374: I/AdWhirl SDK(278): Rotating Ad
09-05 23:09:39.384: D/AdWhirl SDK(278): Dart is <11.333519576064566> of <100.0>
09-05 23:09:39.384: D/AdWhirl SDK(278): Showing ad:
09-05 23:09:39.384: D/AdWhirl SDK(278): nid: xxxxxxxxxxxxxxxxxxxxx
09-05 23:09:39.384: D/AdWhirl SDK(278): name: admob
09-05 23:09:39.384: D/AdWhirl SDK(278): type: 1
09-05 23:09:39.384: D/AdWhirl SDK(278): key: xxxxxxxxxxxxxxxxxxxx
09-05 23:09:39.384: D/AdWhirl SDK(278): key2:
09-05 23:09:39.384: D/AdWhirl SDK(278): Valid adapter, calling handle()
09-05 23:09:39.584: D/dalvikvm(278): GC_FOR_MALLOC freed 2017 objects / 531040 bytes in 159ms
09-05 23:09:39.594: E/Ads(278): The android:configChanges value of the com.google.ads.AdActivity must include screenLayout.
09-05 23:09:39.594: E/Ads(278): The android:configChanges value of the com.google.ads.AdActivity must include uiMode.
09-05 23:09:39.594: E/Ads(278): The android:configChanges value of the com.google.ads.AdActivity must include screenSize.
09-05 23:09:39.594: E/Ads(278): The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.
09-05 23:09:39.594: E/Ads(278): You must have AdActivity declared in AndroidManifest.xml with configChanges.
我已经在我的 AndroidManifest 中声明了 AdActivity,但它仍然在 LogCat 中显示为警告。我还尝试在 configChanges 中添加 uiMode、screenSize 等,但它给了我错误。按照显示 Android Manifest 中 AdActivity 的 decalration 的代码:
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
谢谢你!!