phonegap을 사용하여 Android 앱을 만들고 싶습니다. 간단한 기본 HTML 페이지가이 자습서에 나와 있습니다.Admob 배너가 Phonegap에 표시되지 않음
http://pointdeveloper.com/how-to-add-banner-ads-to-phonegap...
https://phonegap.com/blog/2016/08/09/appfeel-guest-post/
에 "config.xml에"
<gap:plugin name="phonegap-admob" source="npm"/>
가 내 "index.html을"파일에 다음 줄을 추가 한 후
,<!DOCTYPE html>
<html>
<head>
<title>Title Of The App</title>
<meta name="viewport" content="user-scalable=no, initial-scale=1,
maximum-scale=1, minimum-scale=1, width=device-width, min-height=device-
height" />
<link rel="stylesheet" type="text/css" href="css/index.css">
</head>
<body onload="domLoaded()">
<header>pointDeveloper.com</header>
<div class="wrapper">Please Subscribe To My Channel and like the video
\t
\t \t \t \t \t
</div>
<footer class="footer">This is spartaaaa</footer>
<script src="cordova.js"></script>
<script type="text/javascript" src="js/index.js" ></script>
<script type="text/javascript" >
\t \t function adSetter(){
alert(navigator.userAgent);
var admobid = {};
// select the right Ad Id according to platform
if(/(android)/i.test(navigator.userAgent)) {
admobid = { // for Android
banner: 'ca-app-pub-6136762217480399/8690615372',
interstitial: 'ca-app-pub-6136762217480399/5002296586'
};
} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
admobid = { // for iOS
banner: 'ca-app-pub-6869992474017983/4806197152',
interstitial: 'ca-app-pub-6869992474017983/7563979554'
};
} else {
admobid = { // for Windows Phone
banner: 'ca-app-pub-6869992474017983/8878394753',
interstitial: 'ca-app-pub-6869992474017983/1355127956'
};
}
if(AdMob) AdMob.createBanner({
isTesting:true, //Remove this Before publishing your app
adId:admobid.banner,
position:AdMob.AD_POSITION.BOTTOM_CENTER,
autoShow:true});
}
function onDeviceReady(){
alert("device ready");
adSetter();
\t
}
function domLoaded(){
document.addEventListener("deviceready", onDeviceReady, false);
}
</script>
</body>
</html>
심지어 폰갭 빌드에 APK를 수출 내 안드로이드 전화에 테스트의 많은 후, 애플 리케이션은 displpayed하지만, 하단 배너
내가 뭔가를 그리워 않은 곳이 없다? 사전에 감사
편집 : 여기서 오류는 몹이 액세스 할 수 있도록 cordova-plugin-whitelist를 구성 할 필요가
Uncaught ReferenceError: domLoaded is not defined
at onload ((index):10)
:3000/cordova_plugins.js Failed to load resource: the server responded with a status of 500 (Internal Server Error)
(index):27 Uncaught ReferenceError: admob is not defined
at initAds ((index):27)
at Channel.onDeviceReady ((index):97)
at Channel.fire (cordova.js:777)
at cordova.js:231
:3000/favicon.ico Failed to load resource: the server responded with a status of 404 (Not Found)
Chrome 개발자 도구를 사용하여 자바 스크립트 및 네트워크 오류를 확인해보세요. – wildabeast