/*  
  * Licensed to the Apache Software Foundation (ASF) under one  
  * or more contributor license agreements. See the NOTICE file  
  * distributed with this work for additional information  
  * regarding copyright ownership. The ASF licenses this file  
  * to you under the Apache License, Version 2.0 (the  
  * "License"); you may not use this file except in compliance  
  * with the License. You may obtain a copy of the License at  
  *  
  * http://www.apache.org/licenses/LICENSE-2.0  
  *  
  * Unless required by applicable law or agreed to in writing,  
  * software distributed under the License is distributed on an  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY  
  * KIND, either express or implied. See the License for the  
  * specific language governing permissions and limitations  
  * under the License.  
  */  
 var app = {  
   // Application Constructor  
   initialize: function() {  
     document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);  
   },  
   // deviceready Event Handler  
   //  
   // Bind any cordova events here. Common events are:  
   // 'pause', 'resume', etc.  
   onDeviceReady: function() {  
     this.receivedEvent('deviceready');  
   },  
   // Update DOM on a Received Event  
   receivedEvent: function(id) {  
     var parentElement = document.getElementById(id);  
 //    var listeningElement = parentElement.querySelector('.listening');  
 //    var receivedElement = parentElement.querySelector('.received');  
 //    listeningElement.setAttribute('style', 'display:none;');  
 //    receivedElement.setAttribute('style', 'display:block;');  
     initAd();  
     showBannerFunc();  
     showInterstitialFunc();  
     console.log('Received Event: ' + id);  
   }  
 };  
   //initialize the goodies  
   function initAd(){  
       if ( window.plugins && window.plugins.AdMob ) {  
         var ad_units = {  
           ios : {  
             banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx',    //PUT ADMOB ADCODE HERE  
             interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx'  //PUT ADMOB ADCODE HERE  
           },  
           android : {  
             banner: 'ca-app-pub-5187489598351901/8426966507',    //PUT ADMOB ADCODE HERE  
             interstitial: 'ca-app-pub-5187489598351901/1148269958'  //PUT ADMOB ADCODE HERE  
           }  
         };  
         var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;  
         window.plugins.AdMob.setOptions( {  
           publisherId: admobid.banner,  
           interstitialAdId: admobid.interstitial,  
           adSize: window.plugins.AdMob.AD_SIZE.BANNER,  //use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD  
           bannerAtTop: false, // set to true, to put banner at top  
           overlap: true, // banner will overlap webview  
           offsetTopBar: true, // set to true to avoid ios7 status bar overlap  
           isTesting: true, // receiving test ad  
           autoShow: false // auto show interstitial ad when loaded  
         });  
         registerAdEvents();  
         window.plugins.AdMob.createInterstitialView();  //get the interstitials ready to be shown  
         window.plugins.AdMob.requestInterstitialAd();  
       } else {  
         alert( 'admob plugin not ready' );  
       }  
   }  
   //functions to allow you to know when ads are shown, etc.  
   function registerAdEvents() {  
       document.addEventListener('onReceiveAd', function(){});  
       document.addEventListener('onFailedToReceiveAd', function(data){});  
       document.addEventListener('onPresentAd', function(){});  
       document.addEventListener('onDismissAd', function(){ });  
       document.addEventListener('onLeaveToAd', function(){ });  
       document.addEventListener('onReceiveInterstitialAd', function(){ });  
       document.addEventListener('onPresentInterstitialAd', function(){ });  
       document.addEventListener('onDismissInterstitialAd', function(){  
       window.plugins.AdMob.createInterstitialView();      //REMOVE THESE 2 LINES IF USING AUTOSHOW  
       window.plugins.AdMob.requestInterstitialAd();      //get the next one ready only after the current one is closed  
       });  
     }  
 //display the banner  
   function showBannerFunc(){  
       window.plugins.AdMob.createBannerView();  
     }  
 //display the interstitial  
   function showInterstitialFunc(){  
       window.plugins.AdMob.showInterstitialAd();  
     }  
 app.initialize();  
 ==================================================================================  
 index.html  
 index.html  
 ==================================================================================  
2017년 9월 19일 화요일
c2 cordova plugin admob simple
피드 구독하기:
댓글 (Atom)
- 
Rosewell 사건의 유일한 생존자인 외계인 Airl에 관한 이야기를 전해 드리고자 합니다. 이책은 우리에게 정말 귀한 정보 와 통찰력을 주며, 왜 이렇게 삶이란 것이 깊은 고뇌를 동반하는 것인 과정인지 근본적인 대답을 해주며, 죽는다는 것이 어렵...
 - 
呵呵大笑(가가대소) : 우스워서 소리를 크게 내어 웃음 家家戶戶(가가호호) : 집집마다 家鷄野雉(가계야치) : 집안에서 기르는 닭과 산의 꿩이란 뜻 자기 것은 하찮게 여기고 남의 것만 좋게 여김을 비유 可高可下(가고가하) : 어진 사람은 지위...
 - 
스타크래프트 맵 무한 미네랄 만드는 방법입니다. 앱 에디터 다운로드는 다음 글. [동마산 오락실/· 고전·기타] - 스타크래프트 맵 에디터 다운로드 / 2021년 ▲ 맵에디터에서 맵을 불러옵니다. ▲ 파일 선택 ▲ 왼쪽 메뉴에서 미네랄을...
 
댓글 없음:
댓글 쓰기