2012-07-20 18 views
5

मेरे पास एक फोनगैप एप्लिकेशन है और मैं Admob को लागू करने की कोशिश कर रहा हूं।फोनगैप में AdMob को कैसे कार्यान्वित करें

मैं phonegap संस्करण 1.4.1 का उपयोग कर रहा है और मैं अपने संदर्भ के रूप में इस साइट का उपयोग कर रहा: इस प्रकार http://iphone.keyvisuals.com/iphonedev/implementing-admob-ads-in-a-phonegap-project-for-ios-no-plugins-required/

मेरे कोड है:

(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 ]; 
} 

सब कुछ ठीक है, लेकिन जब मैं चला रहा हूँ आवेदन, कोई विज्ञापन प्रदर्शित नहीं किया जा रहा है।

उत्तर

0

कृपया सुनिश्चित करें कि आपका "theWebView" ऑब्जेक्ट अपने वेबलोड को समाप्त करता है। और यह कि बैनर व्यू_ आपके ऑब्जेक्ट की एक पंजीकृत प्रॉपर्टी है।

इसके अलावा, मुझे आशा है कि आप बस अपने बैनर इकाई आईडी को छिपाने के लिए "MY_BANNER_UNIT_ID" डाल दें।

बैनर इकाई आईडी सही होने पर अपनी व्यवस्थापक सेटिंग्स के साथ जांच करें।

और अंत में, कृपया चार्ल्स की तरह एक आईफोन प्रॉक्सी का उपयोग करें या यह सत्यापित करने के लिए कि कॉल को बाहर जाना चाहिए।

0

फ़ोनगैप को अपग्रेड किया गया है। यह नई सुविधाओं का समर्थन करता है। बस इस कोड को अपनी कॉन्फ़िगरेशन में जोड़ें।

<gap:plugin name="com.admob.plugin" version="1.0.0" source="plugins.cordova.io"/> 
संबंधित मुद्दे