How to store large number of database files in android? - android

I have a library app where I store different books as sqlite dbs. The number of books can go on increasing and this gives SqliteFullException when internal storage is used. If I use external storage then is there a way that the user won't be able to access these files? Also, what is the best way to save such large number of databases without exposing them to users?

tough call. currently there is no protection in sdcard.
the internal memory is limited.
if your db file is limited in size <10 mb you can encrypt them and put it in the sdcard, and decrypt it when you want. the size limit is for the decryption time. larger files take longer to decrypt.
currently only security through obscurity is possible.
EDIT
as for your large you can have one db per book.

I would suggest creating a webservice where you store all your data and let the client(phone) request the needed info from the webservice. You can protect your data by building authentication functionality into your webservice.

Related

What is best way to store large data in local for iOS/Android

I'm working on an app and I have tried to use local storage but I'm not sure if it will be OK for my project.
I need to store really large data every second in my local database, and at the end of the day send to my server. This can be large data because every second write my GPS coordinates.
What is best: SQLite, local storage or websql?
I work using cordova.
I appreciate for your help.
Regards
I am an Android developer so this is how it works in Android :
Shared Preferences - simple key/value pairs specific to your application. This is probably the closest to WebStorage - only for small amount of data.
Internal Storage - read/write files(only the app can access it)
External Storage - SD card file storage(app + other apps including the user) can access it).
Databases (SQLite) - better for large amounts of structured data
Network - obviously, you can store/retrieve data remotely if needed (like Firebase).
What would I choose? if data is structured then I would choose SQLite.
More detailed information :
https://developer.android.com/training/data-storage
cordova-sqlite-storage is Native SQLite component with API based.
It will easily handle large data and easy for CRUD operation.
Yes you can use cordova-sqlite-storage for large data inputs. But I think it is also advisable not to stress your device with so much data in it because mobile is just mobile with so many limitations in terms of hardware. Maybe you can just set a treshold of data size and after reaching it, send it to your server then clear your database.
The point is don't stress you device, use minimum data as much as possible to provide a clean app for the users.

Does an SQLite database offer additional security in comparison with Files in Android?

I am making an Android application and need to decide what type of data storage method to use. The size of the data I need to store is fairly small and therefore I was thinking of storing my data in a JSON format and saving it to a file internally.
I want to protect the data I am storing and was wondering if using an SQLite database adds any additional security in comparison with that a file has? The online Android resources states that both internal file storage and an SQLite Database are only accessible to the application they were created by and doesn't introduce either as being dominant in terms of security. Would anyone be able to help with some useful information?

Where to store files for my Android App, Storage and Performance-wise

I am building an android app which requires to have >300 images and ca. 100 audio files for an apk size of around 50mb (after webp compression and proguard).
It is not huge and I could probably live with that. But since I am planning to add other features the size will get bigger and bigger.
I am still interested though, since I'm quite new to android development, if there is a better way to store all this files, perhaps remotely and access them when required.
When the app starts I would have to load all the images into a list and once an element of the list is tapped I would need to open a separate activity and load the sound. So there is no upload from the App, just a resource gathering.
I do not know if it is more efficient this way or to store all the files locally.
Either way I would like to know what my options are. what are the pros and cons of a server (and if it would be a viable solution for me at all) and what is the advantage of storing them locally instead.
Please keep in mind that I working by myself and haven't got money to invest on premium servers or stuff like that.
FILE STORAGE will be best for you. Performance depends on the type and amount of data you are using. You do not need too much of data manipulation so go for file storage if privacy is not your concern for the data as it will be available for all the applications.
Use SQLite Database if the files needs to be protected from other applications.
Use File Storage(internal/external memory) if other applications can also access your files.
Avoid Fetching data from server using JSON parsing/Http requests it will make your app rely on the internet all the time. Unless you are using it to update your database or file storage.

How to store the large volume of steaming data in sqllite for a mobile app

I am building a mobile appfor Reporting and Business Intelligence. The app will show a live stream of billing, payments and other data to management of a company which is doing business across 70 different physical locations. The idea is to see what is happening in the business across all locations as a live stream on line graphs on your tablet.
However the question I have in mind is that with billing and payments data across 70 locations, this stream of data will be huge, and continuous. Over 1 year this dataset will exceed 10GB. Should so much of information be kept in a sqllite database on a mobile? Are there any best practises on handling such large datasets on a mobile app? Tx.
For large databases you should use Realm. It is noSql db and it is more efficient with large data sets. But, more importantly, you can store realm database as ordinary file on SD card.
As I understood from your description, you need to store very large volume of data, but you don't have to access any portion of it (access latest data immediately and previous data with some delay).
You can create system's architecture in that way, so there will be 'database adapter' for Realm, which will take one file, extract data from it, convert it to anther format (in background, of coarse) and then upload those data to AWS or any other cloud storage.
If you use Realm, you can just monitor file size (database is ordinary file), and, if it exceeds given value, create new database file and process previous file in the way I mentioned.
Another approach - interpolate your data and save interpolation factors, but there is math envolved and some data will be lost.
Yeh, all data is kept on remote server, and you uploading some pieces when you need it. Don't know if it's what you searching from.

How to secure a Database of 450 MB in android?

I am creating an app having a large database file of 450 MB. I am storing it in SD card. I want to secure it as it has some sensitive data. If anyone can tell me the best way to do it, it will solve my problem.
I also tried a sample but it was working for small DB file. If I am using 450 MB Db, it is not working and it takes a very long time.
And also please let me know whether it is possible or not to secure such a large data.
It kind of is, but not really. You can encrypt it, and get the decryption key from a server. There is no other way to secure it, as the user can always pop the sd card into an sd card reader. And if the decryption key is local they can decompile your app.
Here's the problem- the encrypted file can't be used by SQLite. So you'd have to decrypt it to disk, and it can be grabbed at that point. So no, its not really possible to secure a database file at all. You're better off keeping the information on a server and querying it via webservice if you want to keep the data secret.

Categories

Resources