I am using phonegap 3.3.0.0.19.6 on a Windows 8 platform. I have Nexus 7 connected via usb to test my app.
I have issue invoking any javascript code using onclick. I have tried to display a simple alert box, which doesn't work. I have then followed the phonegap tutorial:
http://docs.phonegap.com/en/3.0.0/cordova_notification_notification.md.html
I have found similar questions within the following links. However the solutions within these posts, do not answer my current issue with phonegap.
How to fix onclick in Phonegap/Android especially in lower versions of Android?
Android/ Phonegap - onClick() not working
Everything worked ok when I tried triggering a standard alert box in chrome. However, when I deploy to Nexus, no dialog box was displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height, initial- scale=1, minimum-scale=1, maximum-scale=1.5, user-scalable=1">
<title>Example Page</title>
<link rel="stylesheet" href="../www/css/themes/default/jquery.mobile-1.4.2.min.css">
<link rel="stylesheet" href="../www/css/themes/default/jqm-demos.css">
<link rel="shortcut icon" href="../www/favicon.ico">
<script src="../www/js/fontsize.js" type="text/javascript" charset="utf-8"></script>
<script src="../www/js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="../www/js/jquery.mobile-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="phonegap.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
//wait for device api libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device apis are available
function onDeviceReady() {
// empty
}
function showAlert() {
navigator.notification.alert(
'Message box please display....', // message
altertDismissed, // no callback
'Message Box Title', // title
'Continue' // button texr
);
}
</script>
</head>
<body>
<div class="txtwrapper">
<div data-role="page">
<div data-role="header">
<h1>Example Page</h1>
</div><!-- /header -->
<div role="main" class="ui-content">
<p><a href="#" data-inline="button" data-role="button" data-ajax="false" onclick="showAlert(); return false;">Show Alert</a></p>
</div><!-- /content -->
</div><!-- /page -->
</div><!-- /textWrapper -->
</body>
</html>
I have used plugman to install to install the plugin
plugman install --platform android --project example --plugin org.apache.cordova.dialogs
The nexus is running Android 4.4.2
At the moment I can not trigger any javascript code using onclick.
A solution using the native alert box or the standard alert message box would answer my question.
Thanks in advance