Phonegap la Géolocalisation ne fonctionne pas

Je suis en utilisant Phonegap.La géolocalisation pour obtenir la position actuelle de l'utilisateur.

Et j'ai trouvé cet exemple dans la documentation sur le site officiel.

Cependant, malgré le fait que onDevice prêt est exécutée, ni le succès, ni d'erreur de la fonction de rappel est exécutée. Et je suis vraiment confus par ce.

document.addEventListener("deviceready", onDeviceReady, false);

    //Cordova is ready
    //
    function onDeviceReady() {
      alert('deviceready');
        navigator.geolocation.getCurrentPosition(onSuccess, onError);
    }

    //onSuccess Geolocation
    //
    function onSuccess(position) {
        var element = document.getElementById('geolocation');
        element.innerHTML = 'Latitude: '           + position.coords.latitude              + '<br />' +
                            'Longitude: '          + position.coords.longitude             + '<br />' +
                            'Altitude: '           + position.coords.altitude              + '<br />' +
                            'Accuracy: '           + position.coords.accuracy              + '<br />' +
                            'Altitude Accuracy: '  + position.coords.altitudeAccuracy      + '<br />' +
                            'Heading: '            + position.coords.heading               + '<br />' +
                            'Speed: '              + position.coords.speed                 + '<br />' +
                            'Timestamp: '          +                                   position.timestamp          + '<br />';
    }

    //onError Callback receives a PositionError object
    //
    function onError(error) {
        alert('code: '    + error.code    + '\n' +
                'message: ' + error.message + '\n');
    }
InformationsquelleAutor SolessChong | 2013-05-31