我刚刚将 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 时做错了什么?