Powered by Max Banner Ads 

I posted this info on the PhoneGap Google Group a couple weeks ago and thought I would share it here too. Before we start I should mention that PhoneGap is an excellent open source project by Nitobi that allows you to create native applications for mobile devices using web technologies. Also, I have no affiliation with AdMob. I’ve been using them in my apps for almost 3 years now. They are very dependable and they pay on time (unlike MobClix.)

PhoneGapThe reason I put this quick tutorial together is because I was trying to accomplish this very thing and after extensive googling was not able to find anything. I thought i’d find my answer in the phonegap google group but I was wrong. One person when asked how to setup Admob Ads actually replied “just use iAds, there’s a plugin for that.” There are many problems with that answer. One – maybe I don’t want to use iAds I want to use AdMob. Two – the iAds fill rate tends to be kinda low and I don’t want to loose income. Three – you must install the iAd phonegap-plugin which can be confusing and troublesome. Four – that solution doesn’t even attempt to provide a solution to the question. So without further adieu here’s my solution . . .

1.) Create your normal, everyday phonegap (1.0.0) project in xcode
2.) Import the GoogleAdMobAdsSDK folder and the required AdMob frameworks (I believe the only one that wasn’t already in the phonegap project was MessageUI.framework)
3.) In AppDelegate.h – implement <GADBannerViewDelegate> then #import “GADBannerView.h” & add  GADBannerView *bannerView_; to your @interface
4.) In AppDelegate.m –  #define MY_BANNER_UNIT_ID @”Your AdMob Publisher ID# Here”

Now the tricky part. This caused me to bang my head on the wall for
some time . . .

5.) Change your method webViewDidFinishLoad to this . . .

- (void)webViewDidFinishLoad:(UIWebView *)theWebView
{
    bannerView_ = [[GADBannerView alloc]init];
    [bannerView_ setDelegate:self];
    [bannerView_ setFrame:CGRectMake(0, 0, 320, 50)];

    // Specify the ad's "unit identifier." This is your AdMob Publisher ID.
    bannerView_.adUnitID = MY_BANNER_UNIT_ID;

    // Let the runtime know which UIViewController to restore after taking
    // the user wherever the ad goes and add it to the view hierarchy.
    bannerView_.rootViewController = self.viewController;
    [self.viewController.view addSubview:bannerView_];

    // Initiate a generic request to load it with an ad.
    [bannerView_ loadRequest:[GADRequest request]];

	// only valid if AdGap.plist specifies a protocol to handle
	if(self.invokeString)
	{
		// this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready
		NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString];
		[theWebView stringByEvaluatingJavaScriptFromString:jsString];
	}
	return [ super webViewDidFinishLoad:theWebView ];
}

That’s it.

Some of you may be asking why we didn’t create the bannerView_ in the AppDelegates didFinishLaunchingWithOptions method? You can’t. That’s because the PhoneGap AppDelegate seems to create the webview, then the view controller, then it pushes the webview into the view controller which in turn calls webViewDidFinishLoad. This seems to be the key. We cannot access the viewController object until webViewDidFinishLoad has been called.

I’ve created a sample project which is also setup to load test ads. You can get it from here: AdGap

Tagged with:  

easyAPNS is an open source (free) system for sending Apple’s push notifications to a device. From their website:

What is Easy APNs?
If you are a native iPhone application developer, you may have heard of the Apple Push Notification service (APNs). There are a lot of excellent online guides on how to get your application to receive remote notifications… but what about the other piece of the puzzle… ACTUALLY SENDING A MESSAGE?!?!

This very cool project is brought you by Manifest Interactive.

*NOTE: I was NOT able to get this up and running on GoDaddy Hosting for some unknown reason, but the same exact files worked flawlessly on (mt) MediaTemple

Tagged with:  

Review Scraper is the ideal app to download App Store reviews on a global scale. The App can be downloaded HERE free from Google Code and needs to be compiled.

[nggallery id=2]

Developers can easily track what people are saying about their apps and see how it ranks in all the App Store countries.

• Search for apps using a familiar interface.

• Translate app reviews into your native language (language support is limited to what the Google Translation API supports).

• Downloaded app reviews are saved and can be easily deleted.

svn checkout http://reviewscraper.googlecode.com/svn/trunk/

Tagged with:  

Open Source iPhone Directory

On 04/16/2009, in iPhone Development, by keyvisuals

This was first talked about at 360iDev in San Franscisco early in March. These guys got it up and running quick. This is an excellent hub of information if you are a developer trying to find Open Source code to learn from or expand upon.

open.iphonedev.com

Tagged with:  

Here is another excellent tool for developers to track their daily/weekly/monthly sales figures from iTunes Connect. It’s the Open Source appsales-mobile app. It can be checked out of the GoogleCode Repository HERE using any SVN client. I use the free RapidSVN

From their site:

The newest reports can be downloaded with a single tap and all numbers are automatically converted to your (selectable) local currency.

With clear bar charts you’ll get a quick daily overview of how your apps are doing in the store. For each report you can view percentages of countries and each of your product’s share of the revenue.

The Graphs section offers trend charts for all or individual apps and a pie chart that shows revenue by region for a selectable date range.

Tagged with:  

Wolfenstein 3d for iPhone Open Source!

On 04/16/2009, in Apps, open source, by keyvisuals

I’m sure you remember the classic 1st person shooter Wolfenstein 3d. The creators iD Software have revived the game once again and ported it to run on the iPhone. Non developers can buy the game from the App store for $4.99 Interestingly though, if you are an iPhone Developer, the full source files for the game are released free under an open source license. A full paid ($99) iPhone developer license is required in order to compile the code on your own device.

The source code can be downloaded here from Id’s ftp server

If you are interested in running Wolf3d on the iPhone simulator you need to make some minor code modification. Instruction can be found at ghostradio.net

Tagged with:  

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!