adam
adam

Reputation: 807

Phonegap iOS - device ready not firing other events do

I tried everything but still can't fire the deviceready event. I also tried to fire the pause event which worked OK. I'm using cordova 2.0.0. Here is my code:

<html>
<head>

    <title>Taxiii</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale =1, user-scalable=no" />   
    <meta name="apple-mobile-web-app-capable" content="yes" /> 
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />  
    <link rel="stylesheet" href="reset.css" type="text/css" media="all" />
    <link rel="stylesheet" href="style.css" type="text/css" media="all" />

    <script src="cordova-2.0.0.js"></script>
    <script src="jquery.js"></script>
    <script src="xui.js"></script>
    <script src="iscroll.js"></script>
    <script src="loadData.js"></script>
    <script src="loadServices.js"></script>
    <script src="js.js"></script>
    <script src="methods.js"></script>
    <script src="setSizes.js"></script>
    <script src="map.js"></script>
    <script src="http://maps.googleapis.com/maps/api/js?libraries=places,geometry&sensor=true"></script>

    <script>

       function onLoad() {
          document.addEventListener("deviceready", onDeviceReady, false);
       }

       function onDeviceReady() {
          alert("123")
       }

    </script>

</head>
<body onload="onLoad()">
...

I've tried more syntaxes but none worked.

Upvotes: 1

Views: 580

Answers (1)

Samuli Hakoniemi
Samuli Hakoniemi

Reputation: 19049

There's no need to wrap document.addEventListener("deviceready", onDeviceReady, false); inside function onLoad(). Try without it and tell if it helped.

Upvotes: 1

Related Questions