0

I'm new to PhoneGap Build, and I'm trying to start creating an app in PG Build. I tried just moving everything over, but I'm having trouble, so I started by trying to make a simple app that just shows an alert box. This is still not working, so I thought I'd post my code and see if I can get some help. I have tried multiple different pieces of code, but they don't seem to be working.

I'm testing on an iPad mini, and I have the Apple developer account. The app loads fine-the only problem is that the alert box doesn't show...here's the code:

index.html

<!DOCTYPE html>
<html>
<head>
    <title>Notification Example</title>
    <script src="phonegap.js"></script>
    <script type="text/javascript" charset="utf-8">
        document.addEventListener("deviceready", onDeviceReady, false);
        function onDeviceReady() {
            //Empty
        }
        function alertDismissed() {
            //Do something
        }
        function showAlert() {
            navigator.notification.alert(
                'You are the winner!',
                alertDismissed,
                'Game Over',
                'Done'
            );
        }
    </script>
</head>
<body>
    <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
</body>
</html>

config.xml

(stripped irrelevant code for ease of reading)

....

<feature name="http://api.phonegap.com/1.0/battery"/>
<feature name="http://api.phonegap.com/1.0/camera"/>
<feature name="http://api.phonegap.com/1.0/contacts"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/geolocation"/>
<feature name="http://api.phonegap.com/1.0/media"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/notification"/>

....

Can anyone help? Like I said, I'm new to PG, so I'd really appreciate and help I can get! Thanks!

Caleb
  • 827
  • 2
  • 13
  • 30
  • 1
    Your code works perfectly fine to me. Are you sure that your phonegap.js file is correctly linked? And make sure that it's named phonegap.js because in some instances its named cordova.js. – Andrew Lively Aug 25 '13 at 01:12
  • @AndrewLively It says that all I need to do is include the tag in index.html. It's PG build, so they add the file... – Caleb Aug 25 '13 at 01:17

0 Answers0