0

I'm working on a mobile app, but I have some problems with the phonegap. I'm begginer, but as I read the I have to simply just insert this line to work with phonegap's features.

<script src='phonegap.js'></script>

I don't know exactly the deviceready event is whats part. I try to build the app with jquery, hammer, and NO jquery mobile.

My problem is that the deviceready event is not fires. I tried lots of ways, how to bind the event listener, but I failed.

I tried to bind like this:

document.addEventListener('deviceready', ondeviceready);
function ondeviceready(){
    alert('wooohooo');
}

like this:

$(document).ready(function(){
    document.addEventListener('deviceready', ondeviceready);
});

function ondeviceready(){
    alert('wooohooo');
}

and like this:

$(document).on('deviceready',ondeviceready);
function ondeviceready(){
    alert('wooohooo');
}

Can somebody help me?

(I tested the app on a samsung galaxy s & samsung galaxy note 2)

4

2 に答える 2

1

最後に、理由はわかりませんが、私にとってはうまくいきます。

function ondeviceready(){...}
document.addEventListener("deviceready", ondeviceready);
于 2013-05-18T13:05:17.833 に答える