Failed to place AdMob ads on Android server using Google SDK

I have been looking for an answer for a while, but I cannot find the same set of circumstances, so I am turning to you for help ...

I am trying to use the Google SDK (not admob sdk) to advertise on my Android app. When I run the application in the emulator, the log messages that I see are as follows:

03-25 22:35:17.457: INFO/Ads(853): adRequestUrlHtml: [ contains two <script> tags ] 03-25 22:35:21.028: INFO/Ads(853): Received ad url: [ big long url ] 

Sometimes I get:

 03-25 22:35:21.828: INFO/Ads(853): onFailedToReceiveAd(No ad to show.) 

which maybe I can understand, but I also get:

 03-25 22:50:56.817: INFO/Ads(1084): onFailedToReceiveAd(A network error occurred.) 

If I find the “big long url” above in my desktop browser, I get a 1/2 time announcement and another 1/2 space. (Hello, Dish Network) I never get an error.

I can browse the web using the emulator browser, so the network component works.

The application has Internet privileges.

I am upset by the lack of usability code - I see a lot of people using the old admob SDK and a few code snippets for people using the Google SDK, but not an example / walnut soup example.

I commented on the rest of my code, but to no avail. Here is the main code snippet:

 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AdView adView = new AdView(this, AdSize.BANNER, ADMOB_PUBLISHER_ID); LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout); layout.addView(adView); AdRequest req = new AdRequest(); // req.setTesting(true); adView.loadAd(req); } 

My manifest includes the following:

 <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation"/> 

and

 <uses-permission android:name="android.permission.INTERNET" /> 

My main.xml contains this page layout:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/yellow" android:id="@+id/mainLayout" > 

Admob support did not respond.

Can someone help me or at least direct me to the perfect google sdk guide for admob noobs?

Thanks!

+6
android sdk admob
source share
3 answers

Are you adding attr.xml ???

 <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="com.google.ads.AdView"> <attr name="adSize"> <enum name="BANNER" value="1"/> <enum name="IAB_MRECT" value="2"/> <enum name="IAB_BANNER" value="3"/> <enum name="IAB_LEADERBOARD" value="4"/> </attr> <attr name="adUnitId" format="string"/> </declare-styleable> </resources> 
+1
source share

try adding this permission line to the AndroidManifest.xml file

  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
0
source share

Friends, I meet the same problem today. I followed the goold google instruction. Finally, I get it. You can configure a call download request. Like this:

 AdRequest re = new AdRequest(); //re.setTesting(true); re.setGender(AdRequest.Gender.FEMALE); adview.loadAd(re); 

You can try my example, I put my apk and source code here:

Add Google Admob to Android App

0
source share

All Articles