Search code examples
javascriptandroidtitaniumappcelerator-mobile

titanium appcelerator data storeage for newspaper/magazin


I want to develop app for viewing newspaper/magazine using Titanium Appcelerator, and I have a problem how to store data on phone that user can't access it other way than by app ? what format should that data have (blob, pdf, plain text) ? should they be stored in db, or as a files ? Can You post your suggestions below, please ?


Solution

  • In Titanium you have several options to store data. First you should check the data you get as input. Is it JSON or PDF or plain text or whatever. Following options are available: - store data using integrated databases (SQLite) - this might be appropriate when your input data is plain text or json that can converted to text or something like that. You can also store blob data in database if you want. - store data using file system: on both iOS and Android (not mobileweb i think) you can store data persistent on the file storage. This is useful if your input data is a binary file (pdf or similar).

    However in both cases the user is able and not able to read data. - iOS: The User will be able to read documents persisted on the filesystem and maybe also data located in the database - Android: i think on android this depends on whether the device has root access or not and where you store that data (within app folders or in external / internal but free accessible storage)

    In both cases it's not easy to access this data. Usually a common user won't do that. For a professional user reading this data should be easy. So how can you secure this data, so that the user is not able to read it?

    Either you store the data encrypted in a database (database encryption is not available in titanium by default so you need to use a module or encrypt data on your own) or you store it encrypted (this is also up to you - there is no ready-to-use method) on the filesystem.

    In my opinion the first solution is the better one. I would do the following: - get data (from the server or elsewhere, data type doesn't matter) - convert to base64 (useful & required for binary files but also for plain text) - encrypt base64 with an encryption algorithm of your choice - store in database

    because this can require much memory you should provide the option to remove this data to save space.