How to monetize your MMF game with AdMob
Hello friends;
Based on previous experiences on other apps I have on the AppStore, that uses AdMob to monetize my applications, I did this little research to add AdMob to MMF projects.
This is a work in progress, and you should wait for other ClickTeam member to verify that this will not affect your game's performance, or add any tweak that must be done to make it work properly. So far this is working fine in my tests, but as you should already know, neither me or clickteam is responsible of any mishaps or lose of work (make backups!)
// == To Start
Im assuming you already have your AdMob publisher ID and downloaded the SDK.
This documentation is based on a 3.1.3 Build (The MMF project was build for iPhone 4 but you can change the target build in the project properties)
// ====== Framework Libraries
Please read the AdMob documentation.
The libraries included in this example are: AddressBook, AudioToolbox, MediaPlayer, MessageUI that wasn't included already (CoreGraphics and CoreLocation was already there)
To include them in your project, under the "Targets" node, select your application name, and choose "GetInfo" option in the right right popup.
In the "Target 'yourappname' Info" screen, go to the "General" menu, and under "Linked Libraries" section, with the "plus" button keep adding the libraries required for AdMob.
// ==== AdMob Source code to include
Please read the AdMob documentation.
For this example Im using version 3.0 of AdMob SDK. There's an "AdMob" and "extras" folder.
From the AdMob folder drop these two files into your XCode project:
AdMobDelegateProtocol.h
AdMobView.h
From the extras folder drop these two files into your XCode project:
libAdMobDevice3_0.a
libAdMobSimulator3_0.a
and rename them, erasing the "3_0" part like this:
libAdMobDevice.a
libAdMobSimulator.a
Notice that these files already existed in the "AdMob" project, but these are supposed to be the 3.0 compatible ones.
// ====== Code:
---- file RuntimeIPhoneAppDelegate.h
After this line; #import "Application/CRunViewController.h" add these two:
#import "AdMobView.h"
#import "AdMobDelegateProtocol.h"
in the interface declaration @interface RuntimeIPhoneAppDelegate : NSObject <UIApplicationDelegate> add AdMobDelegate, like this:
@interface RuntimeIPhoneAppDelegate : NSObject <UIApplicationDelegate, AdMobDelegate>
---- file RuntimeIPhoneAppDelegate.m
Just before the -(BOOL) application method and after the windows property declaration, add these two lines:
RuntimeIPhoneAppDelegate* selfController;
NSTimer* _timer;
Inside the -(BOOL) application method, at the very first line before the appPath definition, add:
selfController = self;
Still in the -(BOOL) application method, just before returning with the value YES, add this 4 lines:
AdMobView * ad = [AdMobView requestAdWithDelegate: selfController];
ad.frame = CGRectMake(0, 0, 320, 48);
[window addSubview:ad];
_timer = [NSTimer scheduledTimerWithTimeInterval:(15.0) target: ad selector:@selector(requestFreshAd) userInfo:nil repeats:YES];
just before the @end block of the RuntimeIPhoneAppDelegate implementation, add these two AdMob methods (using your publisher id):
#pragma mark AdMobDelegate
- (NSString *)publisherId;
{
return @"a14c48b5017d958";
}
- (BOOL)useTestAd;
{
return YES;
}
//NOTE: Remember to use your own AdMob published id!!!! Also, don't forget to change the return value to 'NO' in the useTestAd method when you finish your test and are ready to publish.
//====== END
This is it
. let me know if this works for you.
Re: How to monetize your MMF game with AdMob
Wow, thanks, I'll test this as soon as I get a chance!
Re: How to monetize your MMF game with AdMob
Thanks Giovanni, how i can upload 3.1.3 Build in my Mac OS?, only appear IOS4...
Re: How to monetize your MMF game with AdMob
In the Xcode project Build info scroll down to the Deployment settings and change the iOS Deployment Target to 3.1.3
You shouldn't need to do this, unless you want to test on an older device (4.2 or under - 4.2 beta being the latest Xcode) using the latest iOS SDK.
Re: How to monetize your MMF game with AdMob
I'm using the latest Xcode, and I do not see the Build 3.1.3, though old, I think there is still much that version installed base, at least in Latin America itself. How can I download this?
Thanks RhysD and regards,
Re: How to monetize your MMF game with AdMob
http://www.open-tutorial.com/2010/07/20/using-new-iphone-sdk-develop-old-iphone-app/
Re: How to monetize your MMF game with AdMob
Im using XCode 3.2.2 and I change the Base SDK where you can find the previous versions. You can go there by selecting the project info, and in the first GENERAL tab, go down to "Base SDK for all Configuration".
Let me know if you can't find the SDK version there.
Re: How to monetize your MMF game with AdMob
Thanks RhysD...
Giovanni im using Xcode 3.2.3 and canīt find this version, only 3.2 and 4.0.
Re: How to monetize your MMF game with AdMob
Koji, I have been updating XCode since 2 years now, so probably that's why I have several versions.... Lets do some research to see if there's no problem to install previous SDK versions on the Mac (probably by uninstalling and installing from older to newer version). Is that possible, I think I still have some previous xcode installations that I can send to you.
By the way, if you plan to do so, is time to make some Time Machine backups :)
Re: How to monetize your MMF game with AdMob
Thanks Giovanni, but I'll try what I RhysD posting, I imagine that if you have the latest version of Xcode you can compile for any IOS, but debugging and simulator only be for IOS4. And compile with the procedure you wrote before but I could not upload it to my iPhone 2G.
I notice that this works ...
Re: How to monetize your MMF game with AdMob
Did you finally found the missing SDK then?
Re: How to monetize your MMF game with AdMob
No. Follow the procedure I RhysD posting, here is the link.
http://www.open-tutorial.com/2010/07/20/using-new-iphone-sdk-develop-old-iphone-app/
Re: How to monetize your MMF game with AdMob
I have no problem with the different SDK versions. Let me know if the AdMob works for you.
Re: How to monetize your MMF game with AdMob
I have no problem with the different SDK versions. Let me know if the AdMob works for you.