07-31-2012 06:12 AM
I'm developing a HTML5 Webworks application for Blackberry OS 5+.
I have to sotre user name and password and I don't know how.
How can I do it?
07-31-2012 09:16 AM
useLocalstorage
.
07-31-2012 09:17 AM
like following example
/*
* setValue()
* Saving the value to the persistent storage
* @param key : key for the value
* @param value : value to be stored
*/
function setValue(key, value) {
//saves to the persistent storage, "key", "value"
localStorage.setItem(key, value);
}
07-31-2012 09:23 AM - edited 07-31-2012 09:30 AM
And what happens if local storage is not available? Is local storate available on all Blackberry OS 5+ device?
07-31-2012 09:33 AM
If u aware with phonegap /webworks than u needs to write you own plug-in for that because I feel sqlite api in WebWorks support with OS6+
https://developer.blackberry.com/html5/apis/bb_ind
07-31-2012 09:37 AM
07-31-2012 09:42 AM
I don't think so. I feel u must be using webworks than why don’t u write you own plug-in for that
07-31-2012 09:47 AM
07-31-2012 11:59 AM
Would storing it in a SQLite database work for you? On PB the database is encrypted but on BB I believe the database file is accessible by anyone.
Cheers,
08-01-2012 10:04 AM - edited 08-01-2012 10:09 AM
> And what happens if local storage is not available?
You'll have to test that. Most likely an exception is thrown, you can catch that if you like.
> Is local storate available on all Blackberry OS 5+ device?
https://developer.blackberry.com/html5/apis/locals
So nope, OS6 and above only.
You really wanna bother with supporting old devices?
There's loads of other stuff not working the same on OS5 devices.
For instance HTML code is slightly different, not fully supporting HTML5.
NB: you can also try the good old traditional browser cookie approach, since WebWorks apps do run in sort of a browser.
Alternatively HTML5 Database is available in OS5+ for storage also.
https://developer.blackberry.com/html5/apis/databa
I think LocalStorage is a very simplified API to the same thing: key & value storage only.