Admob Integration

Forum for posting sample code and examples, new posts creation is not allowed, but everybody can comment

Re: Admob Integration

Postby tarnfeld » Sat Oct 03, 2009 8:16 am

Well a really simple solution would be to check for wifi and cellular before calling the objective-c class, this way the user won't even see the AdMob if the are not connected to the internet, as not all iPod Touch's are :)

For example:
Code: Select all
function checkWebLoad() {
   var wifi = NKIsInternetAvailableViaWifi();
   var celular = NKIsInternetAvailableViaCellularNetwork();
   
   if(wifi == 1) {
      // This is where you will put your AdMob code
   }
   else {
      if(celular == 1) {
         // This code will only run if the above IF for the wifi connection returns 0
      }
      else {
         // Nothing happens
      }
   }
}


Any use?
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Re: Admob Integration

Postby billymay » Sat Oct 03, 2009 12:43 pm

yes, that is actually pretty simple as well, let me try it out! =)

Billy
billymay
 
Posts: 73
Joined: Mon Aug 24, 2009 9:23 pm

Re: Admob Integration

Postby d0csp33d » Tue Jan 19, 2010 6:53 am

I placed ~6 files in the classes folder (admob delegates, controllers, view, ...) and the following script in a page;
Code: Select all
<script>
function updateAdvert()
{
   CallNKitAction("nextAd?className=AdmobController");
    setTimeout("updateAdvert()", 20000);
}
</script>
<script type="text/javascript">
NKRegisterClass("AdmobController");
{
   CallNKitAction("showAdmob?className=AdmobController");
   setTimeout("updateAdvert()", 20000);
}
</script>
<a href="#" onCLick="showAdmob();">Show Admob advert!</a><br>
<a href="#" onCLick="refreshAdmob();">refresh ad!</a><br>
<a href="#" onCLick="removeAdmob();">remove ad!</a><br>


I have an error (1 error):
".objc_class_name_AdMobView", referenced from:
literal-pointer@__OBJC@__cls_refs@AdMobView in AdmobController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


Any ideas?
User avatar
d0csp33d
 
Posts: 175
Joined: Mon Jul 13, 2009 2:23 pm

Re: Admob Integration

Postby sunny » Tue Jan 19, 2010 6:58 am

AdMobView is a class of admob framework, you did not include it, drag admob libs in your peoject
User avatar
sunny
Staff
 
Posts: 1787
Joined: Sat May 30, 2009 5:18 am
Location: kiev, Ukraine

Re: Admob Integration

Postby d0csp33d » Tue Jan 19, 2010 7:06 am

I did include the "adMobview.h" file into my classes folder. ??
I transferred 2 libs files into my Frameworks folder but got 15 errors. :o
User avatar
d0csp33d
 
Posts: 175
Joined: Mon Jul 13, 2009 2:23 pm

Re: Admob Integration

Postby sunny » Tue Jan 19, 2010 7:29 am

I edited first post and updated the old sample code, so not it works with recent versions of NimbleKit.
just re-download sample project to have working template.
for information if you'll need in future, the errors it gave you first time and second time it's linker error that some functions or classes can not be found, to resolve that all you need to do is to add required library, which is really easy to find -> in Xcode go Help->Developer Documentation and type the part of the function name to search for it, after it is found you can see right under function name you have framework this function is related to, so you just need to add that framework to fix it.
Admob uses animations and transformations, so it requires QuartzCore.framework which you need to add to project
User avatar
sunny
Staff
 
Posts: 1787
Joined: Sat May 30, 2009 5:18 am
Location: kiev, Ukraine

Re: Admob Integration

Postby ikitx » Wed Feb 10, 2010 10:34 am

The source code is working very well. However, i would like to know how to change the ad from admob ad to another ad.

Thanks you.
ikitx
 
Posts: 23
Joined: Wed Jan 13, 2010 12:00 pm

Re: Admob Integration

Postby sunny » Wed Feb 10, 2010 11:26 am

there is a function refreshAdmob() in javascript.
however it can be requested no so often (maybe every 25 seconds, I don't remember), so if you call that more often it will give no effect.
User avatar
sunny
Staff
 
Posts: 1787
Joined: Sat May 30, 2009 5:18 am
Location: kiev, Ukraine

Re: Admob Integration

Postby ikitx » Wed Feb 10, 2010 11:45 am

sunny wrote:there is a function refreshAdmob() in javascript.
however it can be requested no so often (maybe every 25 seconds, I don't remember), so if you call that more often it will give no effect.


Thanks you for quick response.

One more thing, i created an admob account and added a iphone app. Now i have the publisher id, i want to test my personal ad instead of admob ad.

Any idea? Thanks.
ikitx
 
Posts: 23
Joined: Wed Jan 13, 2010 12:00 pm

Re: Admob Integration

Postby sunny » Wed Feb 10, 2010 12:11 pm

check admobDelegate.m

Code: Select all
- (NSString *)publisherId
{
   return @"a14aa79a0967a16";
}

Replace for your id

Code: Select all
- (BOOL)useTestAd
{
   return YES;
}

change to NO for real ads, however you won't see real ads on simulator and even on device before it is in app store, they have checks for that to avoid you sitting at home and viewing/clicking your even not released app's advertisement.
User avatar
sunny
Staff
 
Posts: 1787
Joined: Sat May 30, 2009 5:18 am
Location: kiev, Ukraine

PreviousNext

Return to Sample Code

Who is online

Users browsing this forum: No registered users and 1 guest