0
我只是將adwhirl集成到我的android應用程序中。 現在我對如何確保廣告在我的應用中顯示有點困惑。爲什麼AdWhirl在我的android應用程序中不顯示添加內容?
我將admob作爲現在唯一的廣告投放網絡。 我的應用程序啓動後,得到類似如下的日誌輸出:
06-10 14:03:08.007: INFO/AdWhirl SDK(4881): Creating adWhirlManager...
06-10 14:03:08.014: DEBUG/AdWhirl SDK(4881): Locale is: de_DE
06-10 14:03:08.014: DEBUG/AdWhirl SDK(4881): Hashed device ID is: ...
06-10 14:03:08.022: INFO/AdWhirl SDK(4881): Finished creating adWhirlManager
06-10 14:03:08.389: DEBUG/AdWhirl SDK(4881): Prefs{...}: {"config": "{"extra":{"location_on":0,"background_color_rgb":{"red":40,"green":53,"blue":98,"alpha":1},"text_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"cycle_time":30,"transition":3},"rations":[{"nid":"706a61fa3ec446c7b016bfa9d39256d4","type":1,"nname":"admob","weight":100,"priority":1,"key":"a14deaa0ed3f8f6"}]}
06-10 14:03:08.389: DEBUG/AdWhirl SDK(4881): ", "timestamp": 1307707109720}
06-10 14:03:08.389: INFO/AdWhirl SDK(4881): Using stored config data
06-10 14:03:08.389: DEBUG/AdWhirl SDK(4881): Received jsonString: {"extra":{"location_on":0,"background_color_rgb":{"red":40,"green":53,"blue":98,"alpha":1},"text_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"cycle_time":30,"transition":3},"rations":[{"nid":"706a61fa3ec446c7b016bfa9d39256d4","type":1,"nname":"admob","weight":100,"priority":1,"key":"a14deaa0ed3f8f6"}]}
06-10 14:03:08.600: INFO/AdWhirl SDK(4881): Rotating Ad
06-10 14:03:08.600: DEBUG/AdWhirl SDK(4881): Dart is <91.2614682720399> of <100.0>
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881): Showing ad:
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881): nid: 706a61fa3ec446c7b016bfa9d39256d4
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881): name: admob
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881): type: 1
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881): key: a14deaa0ed3f8f6
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881): key2:
06-10 14:03:08.936: DEBUG/AdWhirl SDK(4881): Valid adapter, calling handle()
更新我也發現了這個在日誌中
06-10 14:45:34.546: ERROR/Ads(6010): ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifest.xml.
06-10 14:45:34.546: ERROR/Ads(6010): You must have INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.
06-10 14:45:34.764: ERROR/Ads(6010): ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifest.xml.
/更新
我使用此代碼整合AdWhirl進入我的應用程序:
AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);
AdWhirlTargeting.setAge(28);
AdWhirlTargeting.setGender(AdWhirlTargeting.Gender.MALE);
AdWhirlTargeting.setKeywords("banking, credit, interest");
AdWhirlTargeting.setPostalCode("93047");
AdWhirlTargeting.setTestMode(true);
adWhirlLayout = new AdWhirlLayout(this, "my Key");
RelativeLayout.LayoutParams adWhirlLayoutParams = new RelativeLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
LinearLayout layout = (LinearLayout) findViewById(R.id.layout_adwhirl);
layout.addView(adWhirlLayout, adWhirlLayoutParams);
layout.invalidate();
這是應該顯示的廣告屏幕的佈局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#283562">
<LinearLayout
android:id="@+id/layout_adwhirl"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@android:color/black"/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="@id/layout_adwhirl">
contains the rest of the layout...
</ScrollView>
</RelativeLayout>
的adWhirlLayout但是保持爲空。我如何測試這是因爲沒有向我投放廣告,或者因爲我在集成adWhirl時做了錯誤?
看起來不錯。你確定你沒有任何佈局問題? – Danail 2011-06-10 12:17:24
我添加了我的佈局,使用這種配置時,廣告空間不可見,因爲adWhirl視圖的高度爲0,寬度爲0 – Janusz 2011-06-10 12:22:47
我將包含廣告的linearlayout的寬度設置爲固定大小,只顯示黑色區域 – Janusz 2011-06-10 12:27:31