为什么AdWhirl在我的android应用程序中不显示添加内容?
问题描述:
我只是将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时做了错误?
答
好这条线从日志显示的问题:
06-10 14:45:34.764: ERROR/Ads(6010): ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifest.xml.
接入网络状态的权限是不可选的AdMob广告。如果您想使用Admob,则必须在清单文件中要求此权限。
添加
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
到清单标签在你的应用程序manifest.xml文件。
看起来不错。你确定你没有任何布局问题? – 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