Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Device: BlackBerry Torch
Accepted Solution

Webworks app won't run on device (openDatabase call fails)

This has been causing me a lot of grief and I'm hoping to summarize it all here and find an answer. 

 

The app works well using Chrome and Ripple. This app is using jQuery and jQuery Mobile and needs to use a SQLite database. I read up on the HTML5toGearsAPI is needed if you want to support BBOS 5.0, so that is included as well.

 

When I load the app onto my torch (my physical device) it shows the splash screen and then a while screen. By adding some alert statements to each line in my document.ready function, I can tell that the database open command is failing.  I just can't figure out why. I feel like I've made some kind of stoopid noobie mistake.

 

So here's the script components from my html file and the open command from the javascript.

	<head> 
	    <title>MyApp</title> 
	    <link rel="stylesheet" href="css/jquery.mobile-1.0b1.min.css" />
		<script type="text/javascript" src="js/html5_init.js" id="html5_init"></script>
	    <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
	    <script type="text/javascript" src="js/jquery.mobile-1.0b1.min.js"></script>
		<script type="text/javascript" src="js/myapp.js"></script>
    </head> 

 

// JScript File
var _db;

$(document).ready(function() {

    alert("Ready");
    _db = openDatabase("myDB", "1.0", "test", 1024 * 1024 * 2, null);

    alert("after open");
}

 Are you not supposed to include the HTML5toGears stuff when running on non-5.0 devices? Is there some kind of onError call that I can use to get more detail? This is really causing problems and I cant even seem to get past GO.

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Retired
ababut
Posts: 46
Registered: ‎07-08-2010
My Device: Superberry

Re: Webworks app won't run on device (openDatabase call fails)

Bill, sorry to hear it's been a frustrating start. Please use the latest version of the WebWorks Packager (2.1.1) found here at step 2:

http://us.blackberry.com/developers/browserdev/widgetsdk.jsp

You don't need to include this tag in your page:
&lt;script type="text/javascript" src="js/html5_init.js" id="html5_init">&lt;/script&gt;

It's now bundled in automatically. I suspect that by including it twice you're seeing a conflict. Let me know if that makes your problem go away.
-------------------------------------------------------------------------------------------------
Useful resources, food for the brain:
Web(Works) KB - http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/tkb-p/browser_dev%40tkb
Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Device: BlackBerry Torch

Re: Webworks app won't run on device (openDatabase call fails)

I did grab the latest version after a filename problem with jquerymobile (something had a '-' in the name). I will remove the HTML5_init script element and try it again tonight. Thanks!

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Retired
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold

Re: Webworks app won't run on device (openDatabase call fails)

Hi ,

 

I believe the reason is the null callback. Remove it and I think it will fix your problems.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Device: BlackBerry Torch

Re: Webworks app won't run on device (openDatabase call fails)

Thank you jeff! that was exactly the problem! I didn't want a callback, but wanted to remember that one was possible, so I stuck a null there.  I'm glad to have this resolved!

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids