2012-08-11 3 views
0

this AdMob plugin for phonegap을 사용하고 있으며 완벽하게 작동하고 있습니까? 당신은 read here how I did it if you need입니다. 제 질문은이 플러그인을 사용하여 iOS 앱의 삽입 광고 (전체 화면을 차지하는)를 만드는 방법입니다.iOS 용 phonegap과 함께 AdMob 플러그인을 사용하는 광고 소재 광고

도움 주셔서 감사합니다.

+0

이 문제를 해결하는 데 도움이 되었습니까? – rubdottocom

답변

0

그래야 삽입 광고가 작동하도록 코드를 작성해야합니다. 해당 플러그인을 보면 배너에만 작동하는 것처럼 보입니다. 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]; 
} 
+0

위의 코드를 매우 고맙게 생각합니다. 저는 Obj C 프로그래밍에 익숙하지 않지만 다른 언어를 알고 있습니다. 코드를 검토하고 컴파일 해 보겠습니다. 내 질문에 대한 솔루션이 이미 내장되어 있었다. –