Have tried out in device running on Android Marshamallow, Cordova 6.1.1, cordova android 5.1.1. The plugin works fine and i m able to get the app version using both jquery and non jquery based approach as mentioned in the plugin documentation. The code is as follows, .
index.html
<html>
<head>
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>Version Checker</title>
</head>
<body>
Get Version(jQuery based) <input type="button" value="Version" name="version" id="version"/><br>
Get Version <input type="button" value="Version" name="version" id="version1"/><br>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</body>
</html>
app.js
$(document).ready(function() {
document.addEventListener("deviceready", onDeviceReady, false);
});
function onDeviceReady() {
$('#version').click (function() {
cordova.getAppVersion.getVersionNumber().then(function (version) {
alert('verion(jQuery based)' + version);
});
});
$('#version1').click (function() {
cordova.getAppVersion.getVersionNumber(function (version) {
alert("version - " + version);
});
});
}
cordova.getAppVersion.getVersionNumber(function (version) { alert(version); });
is working proper for me when i put this code in 'onDeviceReady' – HardikDG