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
New Contributor
iaogt
Posts: 5
Registered: ‎11-07-2011
My Device: Torch 9800
My Carrier: Claro

Torch 9800 Database Problem

Hi, I'm having a weird issue:

 

I developed an application using database for storage.  When running on OS5 everything was going fine and even on OS 6 it was ok until I tested it using OS 6.0.0.534.

 

My code goes like this:

 

if(blackberry.system.hasCapability('storage.memorycard'))

  objDB = openDatabase("MyDatabase","1.0","MyDatabase", 5*1024*1024, null);

else

  alert('No SDCard');

 

I tried simulators OS 5.0.0.681, OS 5.0.0.586, OS 6.0.0.227 and works ok, but it fails on OS 6.0.0.534.  I traced my code and found that it stops before the database line.  Simulators goes blank, it kind of freezes itself but then later (10 secs) quits the application. Any ideas?

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Torch 9800 Database Problem

Hi iaogt,

 

I don't believe in 6.0+ you actually need to have a memorycard present.

 

Also I've often seen bugs when you pass in null for the creation callback, try passing nothing at all like this

 

if(blackberry.system.hasCapability('storage.memorycard'))
  objDB = openDatabase("MyDatabase","1.0","MyDatabase", 5*1024*1024);
else
  alert('No SDCard');

 




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)
Please use plain text.
New Contributor
iaogt
Posts: 5
Registered: ‎11-07-2011
My Device: Torch 9800
My Carrier: Claro

Re: Torch 9800 Database Problem

Thanks for the advice,

 

I tried your suggestion but behaviour is the same.

 

I've compiled using webworks sdk 2.0 and 2.2

Also, I'm including html5ToGears in the project.

 

I've noticed that on emulators using OS lower than 6.0.0.534 works fine but higher than that doesn't work.

 

Is there any way to log javascript errors ocurred on execution time in the widget?

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Torch 9800 Database Problem

Hi iaogt,

 

You do not need to include html5ToGears, as in the new SDKs it will automatically be injected and used if necessary. 

 

As per logging, there are alot of ways from alerts, to webInspector (on 7.0) to modifying the dom to java logging using thiscommunity API

 

Have you seen the bug on device or only on simulator?



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)
Please use plain text.
New Contributor
iaogt
Posts: 5
Registered: ‎11-07-2011
My Device: Torch 9800
My Carrier: Claro

Re: Torch 9800 Database Problem

I've seen it on devices too.

 

I'm including html5ToGears because the same widget will be used on OS5 as well on OS6 devices.

 

I tried running your Weather app example and behaviour is the same, it shows the loader but never reachs the next screen.

 

I tried using simulator's clean.bat file but without success.  Is there any file logging what is going on with the simulator ?  Like a debugger?

 

I would really appreciate any thoughts on this,

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Torch 9800 Database Problem

Hi iaogt,

 

...I just realized you said html5ToGears ... you're implementing in gears and NOT html5... May I ask why?

 

The weather app is currently broken. There are problems with both its DB and the weather service it uses. We are in the midst of making fixes and posting new samples.

 

I have tested the code you posted in an onLoad event and had no problems on a 9800 running 6.0.0.534. It must be something you're doing with the database, if you post more code maybe I can help more.

 

There are several debugging options but I would highly reccomend weinre as it should work 5.0+



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)
Please use plain text.
New Contributor
iaogt
Posts: 5
Registered: ‎11-07-2011
My Device: Torch 9800
My Carrier: Claro

Re: Torch 9800 Database Problem

Hi,

 

I'm using gears to be sure it will run on OS 5 devices, as this article suggest:

 

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

 

If I use webworks sdk 2.2 for compiling, can I let html5toGears out and still give support to OS5 devices?  That would be a relief ...

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Torch 9800 Database Problem

Hi iaogt,

 

Actually I'm sorry but you will need to continue adding the file. See we wrote 2 shims HTML5->Gears and Gears->HTML5. We automatically injuect Gears->HTML5 so that HTML5 works from 5.0+.

 

If you wish to continue developing in GEARs (although I'd highly reccomend switching to HTML5) you will need to keep adding the file.



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)
Please use plain text.
New Contributor
iaogt
Posts: 5
Registered: ‎11-07-2011
My Device: Torch 9800
My Carrier: Claro

Re: Torch 9800 Database Problem

I see, is there any doc about storage using HTML5 and not gears? I will switch as long as I can run the application on OS 5 and OS 6.

 

Where can I find the other shim from Gears->HTML5 ?

 

Thanks in advance,

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Torch 9800 Database Problem

Hi iaogt,

 

HTML5 Databases are documented all over the internet, but we have some reasonable docs too - https://bdsc.webapps.blackberry.com/html5/apis/Database.html

 

As per the shim, so long as you use the newest SDK it will automatically be added for you no need to do anything.



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)
Please use plain text.