Skip to main content

Posts

Showing posts with the label Ads

Phonegap plugin for Ads on iPhone

I suppose you know how to create a Phonegap project and also how to add a plugin into the project. First download the required code from here . Add the "Ads" folder to your plugins list. To do this, right-click on the Plugins folder in Xcode and select to “Add Files to…” the folder. Navigate to the Ads folder, and select the folder. Check “Copy items into. . .” and “Create groups for. . .” A ChildBrowser folder is added to the Plugins folder. Copy the content of "js" folder to desired location. Then update the plist to use the plugin In Supporting Files > PhoneGap.plist, add under Plugins (click the down arrow to the left of Plugins, then click on the + symbol to open a new row): Key: SAiOSAdPlugin Type: String (default) Value: SAiOSAdPlugin See the "index.html" for initialization of the code. Now, to display the Ad, call "showTheAd(true)" and whenever you want to hide the Ad call "showTheAd(false)" ...

Integrating AdMob Ads in a PhoneGap Project (iOS)

Open the phonegap project to which AdMob is to be added. Import  GoogleAdMobAdsSDK which can be found here . Add  MessageUI.framework  to the project. To do this " click on project name , go to summary tab, scroll down to the framework section and click +. Then select MessageUI.framework ". In AppDelegate.h import "GADBannerView.h" and add "GADBannerView *bannerView_;" , so that it looks like@interface AppDelegate : PhoneGapDelegate { NSString* invokeString; GADBannerView *bannerView_; }  In AppDelegate.m –  #define MY_BANNER_UNIT_ID @”Your AdMob Publisher ID” Add the following code at the beginning of webViewDidFinishLoad:    bannerView_ = [[GADBannerView alloc]init]; [bannerView_ setDelegate:self]; [bannerView_ setFrame:CGRectMake(0, 45, 320, 95)];//Position of Ad banner bannerView_.adUnitID = MY_BANNER_UNIT_ID; bannerView_.rootViewController = self.viewController; [self.viewController.view addSubview:bannerView_]; [bannerView_...