×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    8

    How can I best manage data for a widget app?

    Hi all,

    A bit of advice please in regards to storing data. The scenario is as follows:

    I'm designing a simple web app (for S60, 5th Edition) which will allow the user to select items from a preloaded array of data (say flowers and plants), and also give them the option of entering species that are not listed on the preloaded list. This will all reside locally on the device. No connection to server is required.
    Is XML an efficient option? or is there a more effective database solution that you guys can suggest?

    Thanks much,

    Rod.

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How can I best manage data for a widget app?

    Hi Rod,

    the only persistency mechanism that WRT widgets support is given by preferences (via setPreferenceForKey() and preferenceForKey() methods). So, the fastest options would be to create a string out of your array and then save it to preferences. The best format for the string depends on the format of your data: if you only have species' names, you can create something like "species1;species2;species3;...". For more structured data, probably JSON is a better approach that XML, since it saves you the effort of parse it back when re-loading it.

    Hope it helps,
    Pit

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    8

    Re: How can I best manage data for a widget app?

    Hey Pit,

    Thanks for your advice. So JSON you recommend. What about using Qt Creator for this project instead? Does it offer a scalable db solution, like sqllite or some other sort? I'm not very experienced with mobile technology so if you could be a bit specific I'd be very appreciative.

    A JSON file should be saved in the same folder where the html, js, css, info.plist, etc files reside, right????

    So the application I'm sketching out will have a list of categories: plants, flowers, seeds, trees, etc, which will have individual species listed under them. The preloaded list is estimated to have about 500 species (divided into the different categories), but since there are hundreds of species more where I live, I want to be able to allow the biologist users (intended audience) to enter (and store obviously) species which may not be listed on the preloaded data.

    Basically I wonder if a WRT project will be powerful enough for this idea, or should I try to use another approach (Qt, for example)???

    Because I'm sure we might have to expand and structure the data further once deployed and tested by the intended audience, they might suggest the species should have a little descriptive paragraph, or even data fields like location, climate, size, etc. So would JSON be able to handle that efficiently you think?

    Thanks very much in advance for your expert advice.

    Rod.

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,553

    Re: How can I best manage data for a widget app?

    If you need to store and access lots of data locally, develop the app using Python, Java or C++.

    If you can store the data on the web, use WRT.

  5. #5
    Regular Contributor
    Join Date
    Apr 2003
    Location
    Akron Ohio USA
    Posts
    229

    Re: How can I best manage data for a widget app?

    For WRT you would store the JSON formatted data as a string in a WRT preference, not as a separate file in the file system.

    Whether or not you need a database instead of a xml/json formatted data depends on your future requirements, and if you think database is a better solution then you might look at another option than WRT.

    Do you need to search through the data? database would probably be more straight forward than trying to set up a javascript based search on xml/json. WRT does not yet support a database, though this might come later as Nokia updates its web browser to be more competitive with other platforms.

    Do you need to add new data? xml/json can be easier to update compared to a relational data structure where you have many different tables. You are just adding new nodes to XML/Json. So there might be advantages in managing data in XML/json compared to a complex relational database. It is also straight forward to extract the data in a single file for xml/json.

    One other thing to consider is that it is straight forward to use a server side process to generate a WRT application, because it is just a renamed .zip archive. So if you have a team in the field generating new data, then they could upload all data and images to a web server then imediatly download an updated copy of the phone app. Other teams could do the same. Pool the resources on the server then dynamically generate the app. The downloaded app can contain the XML/json data as a file in the WRT folder along with media files. It might also be straight forward to compile into a different widget format for other types of phone.

    The other issue is size of data. WRT prefs seem to have some storage space. I've stored 500k json formatted strings. I am not sure if there is a limit. Database might offer more storage.

  6. #6
    Registered User
    Join Date
    Nov 2009
    Posts
    1

    Re: How can I best manage data for a widget app?

    Thanks hp3, i remember someone posting about storing persistent data in cookie. But then it had limited space of 4K only. Guess the approach you suggested is lot cleaner & has more space to hold persistent data too.

  7. #7
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How can I best manage data for a widget app?

    Hi pocha.sharma,

    you're right: using WRT preferences is a more consistent (and supported) method of saving data locally, and has no limits about data size (apart from physical memory, obviously ).

    Pit

Similar Threads

  1. restore the data after launching app next time
    By sunitha.m13 in forum Symbian
    Replies: 3
    Last Post: 2010-01-27, 13:56
  2. Post Data from a widget
    By testbot in forum Symbian
    Replies: 1
    Last Post: 2009-11-29, 10:11
  3. Widget and GPS data application
    By nair.shanker in forum Symbian
    Replies: 1
    Last Post: 2009-03-11, 07:24
  4. symbian signed testing problem.
    By anglina in forum Symbian
    Replies: 0
    Last Post: 2007-02-01, 10:15
  5. GPRS connection problems on 6600..
    By suckho in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2005-12-02, 14:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×