I am working on a blackberry project and ran into some problems with the simulator and I don't know why it is happening nor how to debug this problem.
What I am using
I am using some other jquery plugins as well.
I am getting a few problems
Problem 1
function onDeviceReady()
{
// do your thing!
alert("PhoneGap is working");
}
$(document).ready(function()
{
document.addEventListener("deviceready", onDeviceReady, false);
});
I have this in my index.html (these are html 5 pages) and when the application loads I see this alert box what is expected. However when I go to an new html page that does not have this code I see this alert box again and I can't figure out why.
I am not sure if this just a buggy version or what as if I go and use "7.0+" simulator I do not get this error anymore.
Problem 2
When I load up the application through the simulator in 6.0.0 it will just randomly crash. Sometimes it will just load up my main page and just crash. Sometimes I have to click around for a while and it will crash.
I try to use the Tools-Show Event Log but it records nothing so I am not sure how to even debug this.
Both of these problems go away if I am using OS 7.0+
I have faced the same issue what you are facing right now.
First of all i would suggest not to use this $(document).ready(function()
Do something like this
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
document.addEventListener("pause", onPause, false);
}
function onPause() {
}
<body onload="onLoad()">
</body>
Secondly the issue what you are facing is because of a buggy 9800 simulator. Download it again from the blackberry site and reinstall it. The issue is that the device ready is called always when you change a page. This was a bug in Blackberry 9800 simulator. Although If you try to run this in any BB OS 7 simulator then it will work perfectly...
Hope it helps :)