この AdMob プラグインを phonegapに使用していますが、完全に機能していますか? 必要に応じて、私がどのようにそれを行ったかをここで読むことができます。私の質問は、このプラグインを使用して iOS アプリ用のインタースティシャル広告 (画面全体を占有する) を作成する方法です。
ご協力ありがとうございました!
この AdMob プラグインを phonegapに使用していますが、完全に機能していますか? 必要に応じて、私がどのようにそれを行ったかをここで読むことができます。私の質問は、このプラグインを使用して iOS アプリ用のインタースティシャル広告 (画面全体を占有する) を作成する方法です。
ご協力ありがとうございました!
したがって、インタースティシャルを機能させるには、独自のコードを作成する必要があるようです。そのプラグインを見ると、バナーでしか機能しないようです。Objective C の開発にどれだけ精通しているかはわかりませんが、実装の概要を説明することができます。
必要に応じて新しいプラグインを作成するか、既存のプラグインに追加することができます。これを頭のてっぺんから投げ捨てるだけなので、コンパイルエラーなどなしに動作するかどうか疑問です:
- (void) createInterstitial:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options
{
NSLog(@"Create Interstitial executed");
// Make sure you create an adInterstitial property
if(self.adInterstitial)
return;
if([options objectForKey:@"siteId"])
{
NSLog(@"Setting site Id");
self.siteId=[[options objectForKey:@"siteId"] description];
}
// Note that the GADBannerView checks its frame size to determine what size
// creative to request.
//Initialize the banner off the screen so that it animates up when displaying
self.adInterstitial = [[[GADInterstitial alloc] init] autorelease];
// Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID
// before compiling.
self.adInterstitial.adUnitID = self.siteId;
self.adInterstitial.delegate = self;
}
- (void) loadInterstitial:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{
NSLog(@"Load interstitial executed");
if(!self.adInterstitial)
[self createInterstitial:arguments withDict:options];
GADRequest *request = [self createRequest];
[self setLocation:&request withDict:options];
[self.adInterstitial loadRequest:request];
}
- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {
[interstitial presentFromRootViewController:self];
[self.webView stringByEvaluatingJavaScriptFromString:@"window.plugins.AdMob.adViewDidReceiveAdCallback();"];
}
- (void)interstitial:(GADInterstitial *)interstitial
didFailToReceiveAdWithError:(GADRequestError *)error {
NSLog(@"Failed to receive ad with error: %@", [error localizedFailureReason]);
NSString* jsString = [NSString stringWithFormat:@"window.plugins.AdMob.didFailToReceiveAdWithErrorCallback(%@);",
[error localizedFailureReason]];
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
}