我很难让 adwhirl 在我的应用程序中与 admob 一起工作。
adwhirl.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/llAd">
<com.adwhirl.AdWhirlLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/timer_ads"/>
</LinearLayout>
我的活动
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.adwhirl);
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 = (AdWhirlLayout)findViewById(R.id.timer_ads);
RelativeLayout.LayoutParams layoutParams = new
RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
int diWidth = 320;
int diHeight = 52;
int density = (int) 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.llAd);
layout.setGravity(Gravity.CENTER_HORIZONTAL);
// layout.addView(adWhirlLayout, layoutParams);
//layout.addView(textView, layoutParams);
layout.invalidate();
//new ScanThread().execute(Util.getAuth(this),Util.getURL(this));
}
安卓清单
<meta-data android:value="(my-adhwhirl-key)"
android:name="ADWHIRL_KEY"/>
</activity>
<activity android:name="com.google.ads.AdMobActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:configChanges="orientation|keyboard|keyboardHidden" />
日志
09-12 02:04:10.403: INFO/AdWhirl SDK(729): Creating adWhirlManager...
09-12 02:04:10.403: DEBUG/AdWhirl SDK(729): Locale is: en_US
09-12 02:04:10.413: DEBUG/AdWhirl SDK(729): Hashed device ID is: 7d1dd13a2fa91c0ad174cb69a11549a3
09-12 02:04:10.413: INFO/AdWhirl SDK(729): Finished creating adWhirlManager
09-12 02:04:10.423: DEBUG/AdWhirl SDK(729): Prefs{55aa3dea659c46c0bef87c711a5d524e}: {"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":15,"transition":8},"rations":[{"nid":"6b5563f8f4a64cd5b7abfbbeec54e0f8","type":1,"nname":"admob","weight":100,"priority":1,"key":"a14e6d5816c612a"}]}
09-12 02:04:10.423: DEBUG/AdWhirl SDK(729): ", "timestamp": 1315792993877}
09-12 02:04:10.423: INFO/AdWhirl SDK(729): Using stored config data
09-12 02:04:10.423: DEBUG/AdWhirl SDK(729): 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":15,"transition":8},"rations":[{"nid":"6b5563f8f4a64cd5b7abfbbeec54e0f8","type":1,"nname":"admob","weight":100,"priority":1,"key":"a14e6d5816c612a"}]}
09-12 02:04:10.493: INFO/AdWhirl SDK(729): Rotating Ad
09-12 02:04:10.493: DEBUG/AdWhirl SDK(729): Dart is <27.61096846453517> of <100.0>
09-12 02:04:10.573: DEBUG/AdWhirl SDK(729): Showing ad:
09-12 02:04:10.573: DEBUG/AdWhirl SDK(729): nid: 6b5563f8f4a64cd5b7abfbbeec54e0f8
09-12 02:04:10.573: DEBUG/AdWhirl SDK(729): name: admob
09-12 02:04:10.573: DEBUG/AdWhirl SDK(729): type: 1
09-12 02:04:10.573: DEBUG/AdWhirl SDK(729): key: a14e6d5816c612a
09-12 02:04:10.573: DEBUG/AdWhirl SDK(729): key2:
09-12 02:04:10.583: DEBUG/AdWhirl SDK(729): Valid adapter, calling handle()
09-12 02:04:10.643: WARN/InputManagerService(60): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@4075f600 (uid=10018 pid=525)
09-12 02:04:11.094: INFO/ActivityManager(60): Displayed com.trandroid/.AddTorrent: +790ms
09-12 02:04:11.283: DEBUG/dalvikvm(60): GC_CONCURRENT freed 710K, 45% free 4267K/7751K, external 1252K/1764K, paused 9ms+7ms
09-12 02:04:58.393: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
09-12 02:09:58.403: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
09-12 02:14:58.413: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
09-12 02:19:58.423: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
09-12 02:24:58.433: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
09-12 02:29:58.443: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
我已经在 adwhirl 上设置了我的 admob 发布者 ID。请帮忙!