开发者

Admob ad comes up less then 1/2 the time while in test mode using new admob sdk

I just added a new site on Admod and it sems like they are using a new sdk, where the old one was admod-sdk-android and the new one is GoogleAdMobsdk. I followed googles example code, except I set the testing flag to true. Well it came up at first, all excited that it worked, but when I ran it again, it did not come up. It seems like the ad comes up less then half the time. I know this would be ok if it was not in testing mod. Should the ad allwys come up if the testing flag is true? code

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    View mCall = findViewById(R.id.call);
    mCall.setOnClickListener(this);

    View mAbout = findViewById(R.id.about);
    mAbout.setOnClickListener(this);

    View mWhatWeDo = findViewById(R.id.whatwedo);
    mWhatWeDo.setOnClickListener(this);

    View mEmail = findViewById(R.id.email);
    mEmail.setOnClickListener(this);

   View mMap = findViewById(R.id.map);
    mMap.setOnClickListener(this);

    // Create the adView
    // Create the adView
    AdView adv = new AdView(this, AdSize.BANNER, "a14d84be1abee56");

    // Lo开发者_C百科okup your LinearLayout assuming it’s been given
    // the attribute android:id="@+id/mainLayout"
    LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout);

    // Add the adView to it
    layout.addView(adv);
    // Initiate a generic request to load it with an ad
    AdRequest t=new AdRequest();
    t.setTesting(true);
    adv.loadAd(t);   

}

layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:background="#ff00ffff"
   android:layout_height="fill_parent"
   >
   <LinearLayout
      android:id="@+id/mainLayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical">
   </LinearLayout>

   <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/header"
      android:layout_gravity="center" />

   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text=""
      android:textSize="8px" />

   <Button
      android:id="@+id/about"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="Who we are"
      android:textStyle="bold"
      android:textColor="#ffff00ff" />

   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text=""
      android:textSize="6px" />

   <Button
      android:id="@+id/whatwedo"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textColor="#ffff00ff"
      android:text="What we do" />

   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text=""
      android:textSize="6px" />

   <Button
      android:id="@+id/call"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textColor="#ffff00ff"
      android:text="Call Us" />

   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textSize="6px"
      android:text="" />

   <Button
      android:id="@+id/map"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textColor="#ffff00ff"
      android:text="Driving Directions" />

   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textSize="6px"
      android:text="" />

   <Button
      android:id="@+id/email"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textColor="#ffff00ff"
      android:text="Email Us" />

</LinearLayot>


I faced the same issue as well. The new SDK isn't behaving in the same way the old one was in this regards. I suggest you remove the testing mode and try seeing in the admob reporting page whether you are able to see page requests for your app there..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜