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
agungeddy
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Gears.zip sample application doesn't work on OS 6 Simulator???

Hi everybody,

 

I have tried gears widget sample application that available here:

 

http://docs.blackberry.com/id-id/developers/deliverables/12792/SQLite_install_and_run_sample_widget_...

 

 

When i tried it on OS 5 Simulator (Blackberry 9700  and Blackbery 9550) the gears application was work fine.

 

But if i tried it on OS 6 Simulator (Blackberry 9800 - 6.0.0.284), error occured when i clicked the "Add item to list" button in the application, with error message :

 

TypeError: Result of expression '_db' [undefined] is not an object

 

So what happened here,  is OS 6 not  support to gears or how??

 

anybody can help?

 

thank you before...

Please use plain text.
Developer
jmace
Posts: 482
Registered: ‎10-24-2008
My Device: 9300
My Carrier: AT&T

Re: Gears.zip sample application doesn't work on OS 6 Simulator???

OS 6 does not support Google gears. If you are targeting both OS 5 and 6, you should use the HTML5 standards for web databases and include the javascript shim for gears (so that OS 5 devices also work).

 

http://supportforums.blackberry.com/t5/Web-Development/Supporting-Gears-using-HTML5-in-BlackBerry-Wi...

 

The link above should get you started.

_________________________________________
www.jasonmace.com/blackberry
Please use plain text.
Developer
agungeddy
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Gears.zip sample application doesn't work on OS 6 Simulator???

[ Edited ]

i have already known about that article, and i've also got the  HTML5-to-Gears.zip file from there,

then i did i little changed in gears sample application by added some kind like: <script type="text/javascript" src="<path to file>/html5_init.js" id="html5_init"></script>  in the header of index.html.

 

After that, i tried it again in Blackberry 9800 Simulator, still got the same error.

 

So Mr jmace, are there any another things to do should be changed in the  gears sample application , so the sample application work fine in Blackberry 9800 Simulator??


jmace wrote:

OS 6 does not support Google gears. If you are targeting both OS 5 and 6, you should use the HTML5 standards for web databases and include the javascript shim for gears (so that OS 5 devices also work).

 

http://supportforums.blackberry.com/t5/Web-Development/Supporting-Gears-using-HTML5-in-BlackBerry-Wi...

 

The link above should get you started.


 

Please use plain text.
Developer
jmace
Posts: 482
Registered: ‎10-24-2008
My Device: 9300
My Carrier: AT&T

Re: Gears.zip sample application doesn't work on OS 6 Simulator???

Yes, your syntax should change for creating and manipulating the database (i'm assuming since I saw _db in the posts above).

 

instead of the gears syntax, you will use something like 

 

 

var dbSize = 1*1024 * 1024; // 1 MB
var db = openDatabase("DBName","1.0","myDB",dbsize);

...

db.transaction(function(tx){
   tx.executeSql("CREATE TABLE IF NOT EXISTS test(FirstName,Lastname)");
   });

...

 

 

_________________________________________
www.jasonmace.com/blackberry
Please use plain text.
Developer
agungeddy
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Gears.zip sample application doesn't work on OS 6 Simulator???

[ Edited ]

Thank you very much Mr jmace for your responses, starting get some clues here, i really appreciated this..

 

then:

 

- First, where can i get any tutorials or manuals about the new syntax??

- Second, by the way, is it right when in order to have SQLite working, the blackberry device (not simulator) MUST have an SD card? ??


jmace wrote:

Yes, your syntax should change for creating and manipulating the database (i'm assuming since I saw _db in the posts above).

 

instead of the gears syntax, you will use something like

 

 

var dbSize = 1*1024 * 1024; // 1 MB var db = openDatabase("DBName","1.0","myDB",dbsize);  ...  db.transaction(function(tx){    tx.executeSql("CREATE TABLE IF NOT EXISTS test(FirstName,Lastname)");    });  ...

 

 


 

Please use plain text.
Developer
jmace
Posts: 482
Registered: ‎10-24-2008
My Device: 9300
My Carrier: AT&T

Re: Gears.zip sample application doesn't work on OS 6 Simulator???

Try this... I have a blog post of my first OS 6 widget that uses some data storage here (http://www.jasonmace.com/blackberry/?p=36). I think if you modify my code by adding the HTML5_init.js it will work on both OS 5 and 6 (again I think... been a while since I posted that).

 

As for the SD card, yes. An SD card is required to do any database interaction on the BlackBerry in a WebWorks project.

 

I generally have a helper script in my code that detects an SD card before any database operations. Something like the following...

 

 

 

function checkSDCard() {
   if(!blackberry.system.hasCapability('storage.memorycard') && blackberry.system.model != "9000")
      return false;
   else
      return true;
}

 

You'll probably see I am checking if the device is a Bold 9000. That device (and I think one other) allowed for storage of the Sqlite database on an in device memory space. Just a small quirk to be aware of.

 

 

_________________________________________
www.jasonmace.com/blackberry
Please use plain text.
Developer
agungeddy
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Gears.zip sample application doesn't work on OS 6 Simulator???

[ Edited ]

Thank you very much Mr jmace, those are really give me some enlightments... really aprreciated.. :smileyhappy:

 

Please use plain text.
Contributor
mobabelsupport
Posts: 21
Registered: ‎11-24-2010
My Device: Not Specified
My Carrier: T-com

Re: Gears.zip sample application doesn't work on OS 6 Simulator???

[ Edited ]

Hi, i have tested your widgets(OS 6 widget that uses some data storage here (http://www.jasonmace.com/blackberry/?p=36).) on device BB 9800, i got such error:

SECURITY_ERR: DOM Exception 18

 

please refer to this POST:

http://supportforums.blackberry.com/t5/Web-Development/Sqlite-working-on-OS-5-but-not-on-OS6/td-p/64...

 

Have you tested your widgets on real OS 6.0 device??

Please use plain text.
Developer
jmace
Posts: 482
Registered: ‎10-24-2008
My Device: 9300
My Carrier: AT&T

Re: Gears.zip sample application doesn't work on OS 6 Simulator???

[ Edited ]

I have several applications in production currently on a bunch of devices (9800,9700,9300,9550,8520...). 

 

I'll cook up a fresh example that will work on both OS 5 and 6 and post it here when I get a chance.

_________________________________________
www.jasonmace.com/blackberry
Please use plain text.
Contributor
mobabelsupport
Posts: 21
Registered: ‎11-24-2010
My Device: Not Specified
My Carrier: T-com

Re: Gears.zip sample application doesn't work on OS 6 Simulator???

That will be great, if you post here a little database app which can run on the 9800 with OS6.0(real device)!

Please use plain text.