Search code examples
androidcordovajquery-mobilelocal-storagelawnchair

String ValuesConfiguration File in Phonegap with JQM for android


I am developing app for android using Phonegap with JQM. In J2ME app development , We can have centralized file ( message.txt ) we store list of string values which we are going to use. Like that can we have some configuration to get the string values from configuration file. So that we can easily do changes on text values. Could any one tell me. Is it possible .?


Solution

  • There are numerous solutions, you only need to choose one that best serves your purpose.

    Javascript solutions

    All javascript solutions use localstorage as a final storage destination. Only difference is in their implementation, how far did they went to make it easier.

    Lawnchair

    Probably one of most commonly used JSON localstorage frameworks, also a framework of my choice. It is fast but probably a little bit confusing first time you see it. But with everything in mind it works very well.

    Persistencejs

    This is an another great solution. Best suited for mobile devices, but still made to work on broad specter of mobile devices (Android, iOS, BB) or desktop browsers. No matter which device is used it will use best storage available ranging from HTML5 WebSQL up to localstorage. This is an excellent solution if you want an easy way into WebSQL but it is a bit harder to work then HTML5 WebSQL.

    localStorageDB

    This one is a newcomer. Easy as Lawnchair but more SQL like. Like Lawnchair it uses only localstorage to store serialized JSON string. It will not work with webSQL.

    Native support

    Here you will also find fa few possibilities. A little bit better solution then JS frameworks, mainly because it used mobile phones native storage support.

    Phonegap Storage

    This is a official Phonegap support for local SQL storage. This is a commonly used functionality. But be warned it can be a little bit buggy. There's a support for every possible mobile platform except WM7+.

    Cordova/PhoneGap sqlite plugin - Android version

    Native interface to sqlite in a Cordova/PhoneGap plugin, working to follow the HTML5 Web SQL API as close as possible. It doesnt suffer from 5MB limit and it mimics classic SQL usage as close as possible. One thing to mention, it supports data encryption. Unlike common Phonegap Storage implementation this one supports Windows Mobile but BlackBerry is not supported.

    Phonegap File

    If you want to stick with files this solution is probably the best one. It is a common Phonegap solution. Store your configuration inside a XML and play with it in Java or Javascript.