Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old August 27th, 2010, 01:24 AM   #1 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Apr 2010
Location: Canada
Posts: 65
 
Device(s): HTC Hero
Carrier: Not Provided

Thanks: 1
Thanked 5 Times in 5 Posts
Default Admob Ads

I was wondering if somebody knew a link to a good tutorial for adding admob ads to your android application. I have checked out several tutorial and followed the steps...including the instructions from admob and my app just force closes now and I do not know where my errors are.

Advertisements
tp_technologies is offline  
Reply With Quote
sponsored links
Old August 27th, 2010, 03:05 AM   #2 (permalink)
New Member
 
Join Date: Aug 2010
Location: Sweden
Posts: 13
 
Device(s): Motorola Milestone
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

Android - Admob For Developers has quite straightforward instructions. It's missing one step that the LunarLander has. Not sure if it's needed, but it might aid debugging at least. The LunarLander example set an AdListener, which logs when ads are fetched, or when they failed to be fetch.

It's also straightforward to do. Just make user Activity class implement com.admob.android.ads.AdListener, and then implement the following methods in your Activity class:

Code:
    public void onFailedToReceiveAd(AdView adView)
    {
        Log.d("AdListener", "onFailedToReceiveAd");
    }

    public void onFailedToReceiveRefreshedAd(AdView adView)
    {
        Log.d("AdListener", "onFailedToReceiveRefreshedAd");
    }

    public void onReceiveAd(AdView adView)
    {
        Log.d("AdListener", "onReceiveAd");
    }

    public void onReceiveRefreshedAd(AdView adView)
    {
        Log.d("AdListener", "onReceiveRefreshedAd");
    }
You also need to set the listener in your Activity's onCreate:

Code:
       
    AdView ad = (AdView) findViewById(R.id.ad);
    ad.setAdListener(this);
If you still can't get it to work, please post logcat output, which should include the traceback. It would also be very helpful to see your code, at least the parts that deals with AdMob.
meskiukas is offline  
Reply With Quote
Old November 8th, 2010, 08:58 PM   #3 (permalink)
New Member
 
Join Date: Nov 2010
Location: Louisville, Kentucky
Posts: 1
 
Device(s): EVO
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

I keep hearing about this LunarLander program with admob in it but I cant find it anywhere. Anyone have a link to it? When I use the link in the SDK I get 404.
Alienmark67 is offline  
Reply With Quote
Old December 3rd, 2010, 02:29 PM   #4 (permalink)
New Member
 
Join Date: Jun 2010
Location: Northeast England
Posts: 6
 
Device(s): HTC Desire
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Angry

Alienmark67, you get the Lunar Lander code when you sign up to admob. But I think you need to have an application on the Market before you can access it.

meskiukas, thanks for your advice. Unfortunately I still can't get my application to show adverts. It's called LGF Card Counter Lite on the app market. I could send you the source code if that helps.

tp_technologies, I still can't find a good tutorial for admob. The only tutorial is a set of steps provided by Admob, but as meskiukas has pointed out, it's mising out some vital steps.

Cheers
leefisher is offline  
Reply With Quote
Old December 4th, 2010, 03:03 PM   #5 (permalink)
New Member
 
Join Date: Jun 2010
Location: Northeast England
Posts: 6
 
Device(s): HTC Desire
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy

I've added the code

AdView ad = (AdView) findViewById(R.id.ad);
ad.setAdListener(this);

Unfortunately I'm now getting a NullPointerException on the 2nd line above. Looks like ad is not being set
leefisher is offline  
Reply With Quote
Old December 5th, 2010, 05:03 AM   #6 (permalink)
Member
 
Join Date: Aug 2010
Location: Norway
Posts: 313
 
Device(s): Samsung Galaxy Nexus
Carrier: Not Provided

Thanks: 0
Thanked 53 Times in 51 Posts
Default

And since you use this as parameter i guess you have implemented the listener in your class?
miXer is offline  
Reply With Quote
Old December 5th, 2010, 02:43 PM   #7 (permalink)
New Member
 
Join Date: Jun 2010
Location: Northeast England
Posts: 6
 
Device(s): HTC Desire
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've added "implements AdListener" to the class declaration if that's what you mean.
leefisher is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:13 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.