Я пытаюсь заставить учебник из Cordova GooglePlus работать. За последние 3 дня я не потратил на это около 16 часов, прочесывая stackoverflow, google и github, и я далеко продвинулся, но продолжаю получать ошибку необработанного типа. Кажется, что я не правильно ссылаюсь на функции в GooglePlus.js. Любые советы будут оценены. Вот созданный мной apk, который выдает те же ошибки App.apk
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height"/>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
<meta name="msapplication-tap-highlight" content="no"/>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="plugins/cordova-plugin-googleplus/www/GooglePlus.js"></script>
<title>Hello World</title>
<script type="text/javascript">
app.initialize();
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function isAvailable() {
window.plugins.googleplus.isAvailable(function(avail) {alert(avail)});
}
function login() {
window.plugins.googleplus.login(
{},
function (obj) {
document.querySelector("#image").src = obj.imageUrl;
document.querySelector("#image").style.visibility = 'visible';
document.querySelector("#feedback").innerHTML = "Hi, " + obj.displayName + ", " + obj.email;
},
function (msg) {
document.querySelector("#feedback").innerHTML = "error: " + msg;
}
);
}
function trySilentLogin() {
window.plugins.googleplus.trySilentLogin(
{},
function (obj) {
document.querySelector("#image").src = obj.imageUrl;
document.querySelector("#image").style.visibility = 'visible';
document.querySelector("#feedback").innerHTML = "Silent hi, " + obj.displayName + ", " + obj.email;
},
function (msg) {
document.querySelector("#feedback").innerHTML = "error: " + msg;
}
);
}
function logout() {
window.plugins.googleplus.logout(
function (msg) {
document.querySelector("#image").style.visibility = 'hidden';
document.querySelector("#feedback").innerHTML = msg;
},
function (msg) {
document.querySelector("#feedback").innerHTML = msg;
}
);
}
function disconnect() {
window.plugins.googleplus.disconnect(
function (msg) {
document.querySelector("#image").style.visibility = 'hidden';
document.querySelector("#feedback").innerHTML = msg;
},
function (msg) {
document.querySelector("#feedback").innerHTML = msg;
}
);
}
window.onerror = function(what, line, file) {
alert(what + '; ' + line + '; ' + file);
};
function handleOpenURL (url) {
document.querySelector("#feedback").innerHTML = "App was opened by URL: " + url;
}
</script>
</head>
<body onload="onLoad">
<div class="app">
<img id="image" style="position:absolute; top:10px; left:10px" src="" />
<h1>Google+</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
<p id="feedback">not logged in</p>
<button onclick="isAvailable()">Available?</button>
<br/><br/>
<button onclick="login()">Login with Google+</button>
<br/><br/>
<button onclick="trySilentLogin()">Try silent login with Google+</button>
<br/><br/>
<button onclick="logout()">Logout</button>
<button onclick="disconnect()">Disconnect</button>
<br/><br/>
<button onclick="window.plugins.googleplus.getSigningCertificateFingerprint(function(res){alert(res)}, function(res){alert(res)})">get cert fingerprint (Android)</button>
</div>
</div>
</body>
</html>