简体   繁体   English

报纸/杂志的钛制加速器数据存储

[英]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 ? 我想开发使用Titanium Appcelerator来查看报纸/杂志的应用程序,但是我有一个问题,如何在手机上存储用户无法通过应用程序以外的方式访问数据的数据? what format should that data have (blob, pdf, plain text) ? 该数据应采用什么格式(blob,pdf,纯文本)? should they be stored in db, or as a files ? 应该将它们存储在db中还是作为文件存储? Can You post your suggestions below, please ? 您能在下面发表您的建议吗?

In Titanium you have several options to store data. 在Titanium中,您有几种选择来存储数据。 First you should check the data you get as input. 首先,您应该检查作为输入获得的数据。 Is it JSON or PDF or plain text or whatever. 是JSON还是PDF或纯文本还是其他格式。 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. 可以使用以下选项:-使用集成数据库(SQLite)存储数据-当您的输入数据是纯文本或json(可以转换为文本等)时,这可能是合适的。 You can also store blob data in database if you want. 如果需要,还可以将Blob数据存储在数据库中。 - store data using file system: on both iOS and Android (not mobileweb i think) you can store data persistent on the file storage. -使用文件系统存储数据:在iOS和Android(我认为不是mobileweb)上,您都可以将持久性数据存储在文件存储中。 This is useful if your input data is a binary file (pdf or similar). 如果您的输入数据是二进制文件(pdf或类似文件),这将很有用。

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) -iOS:用户将能够读取文件系统中保留的文档,甚至还可以读取数据库中的数据-Android:我认为在android上,这取决于设备是否具有root用户访问权限以及您将数据存储在何处(应用内文件夹或外部/内部但免费的可访问存储)

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. 您是将加密的数据存储在数据库中(默认情况下,钛合金中不提供数据库加密功能,因此您需要使用模块或自己对数据进行加密),或者将其存储为加密的(这取决于您-还没有准备好) -to-use方法)。

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 我将执行以下操作:-获取数据(从服务器或其他位置,数据类型无关紧要)-转换为base64(对二进制文件有用,并且对于纯文本也是必需的)-使用您选择的加密算法对base64进行加密-存储在数据库中

because this can require much memory you should provide the option to remove this data to save space. 因为这可能需要大量内存,所以您应该提供删除此数据的选项以节省空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM