11-02-2010 08:52 AM
Is there any way to read the database created by Widget app using Google Gears in native Java application.
When I am trying to open the database on actual device (9700 BOLD), I am getting "net.rim.device.api.database.DatabaseIOException".
Is this something to do with the fact that database created by Gear are by default encrypted.
I am using below Java code to open the database -
In first attempt I am trying to open the database from SDCard, if that fails I am hitting the device memory for database.
Please let me know I am doing anything wrong here, or there is specific way to handle the database created by Google Gear in Java.
Any inputs on this issue are most welcome.
Simulator OS version : 184.108.40.2066
Thanks in Advance!!!
11-02-2010 09:17 AM
It is not possible to open a Gears DB in a Java application. The database is encrypted and can only be accessed by the website or WebWorks/Widget application that created it.
11-02-2010 09:46 AM
Thanks for your quick reply on this.
But, it is quite interesting that, this code runs perfectly on simulator, i didnt get any exceptions as such.
Any workaround on this, because I dont see any option other than updating the database in Java, since I am synching some data to the server in separate thread and want to update the database as per the response from server.
11-02-2010 09:54 AM
I'm curious on why you cannot sync the database from within your widget/WebWorks application?
11-02-2010 10:11 AM
Let me explain you the background on this.
I am developing an offline tool for e-learning, in which I have a set of server API's which are authenticated, for each request I have to set the "Authorization" header in the HTTPRequest.
Earlier we were using the XMLHttpRequest object for server communication, this was working great on all of the simulators, but when we actually ported the application on BB device (9700 BOLD), we ran into authentication issues.
Then we came to know that BASIC authentication is not yet supported by BB Widgets. (Reference : https://www.blackberry.com/jira/browse/WEBAPI-21)
For Sync, I am running a separate thread, and for this reason I am not able to return the server status code to my main Widget App where I am supposed to update the database as per the response code..
So, somehow I want to update the database from Java itself.
11-04-2010 02:00 AM
Hey I got the solution for my problem...
There is no need to read/write the SQLite database in JAVA.
Simply we can pass a callback function to the JS Extension which will handle the database stuff back in widget itself.
More on CallBack functions in JS extensions in below links -