/*
* 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)
i2c_designware 808622C1:04: controller timed out
12월 17 15:55:28 VAST kernel: i2c_designware 808622C1:04: controller timed out root @VAST ~ # cat /sys/bus/acpi/devices/808622C1:01/status ...
-
Rosewell 사건의 유일한 생존자인 외계인 Airl에 관한 이야기를 전해 드리고자 합니다. 이책은 우리에게 정말 귀한 정보 와 통찰력을 주며, 왜 이렇게 삶이란 것이 깊은 고뇌를 동반하는 것인 과정인지 근본적인 대답을 해주며, 죽는다는 것이 어렵...
-
아치 리눅스 한글 간단 사용기 한글 입력기로 ibus 사용 하기로 한다. nabi 도 좋긴 한데 구글 크롬과 심각한 버그로 쓰기 힘든 상태 이므로 nabi 는 패스 하기로 아이뻐스 설치 pacman -S ibus ibus-hangul ...
-
중국 쌍색구(双色球) 빨간공 6개 : 1~33 판란색 1개 : 1~16 빨간색, 파란색 두가지 색이라 쌍색구 라 함 APP LINK https://play.google.com/store/apps/details?id=gotopark....