Android SQLite Storage usage - android

Im using SQLite Storage in my healthcare application.I have some idea of why we are going for local storage
No need of internet connection.
individual Data.
Fast to load.
if we want can take a dump of db in server and can be retrieved.
But, I got some opposite question like
suppose if i lost my phone there is chance to get my personal data from the memory of the device.
kindly help me

You can encrypt the data from SQLite. Either encrypt it on runtime using a custom encryption algorithm, or you can use some APIs for that. The most popular seems to be SQLCipher for Android.

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.

Can I set up a private and secure SQLite database on an iOS or Android phone?

I have an application that stores its data and test results in a SQLite database on either and Android or ios phone.
Is it possible to secure this data so that only the application can access it or is the data open to anyone (that knows how) to go in and make changes to the database?
You could look into encrypting your db. There are libraries like SQLCipher you could look into.
Since the database is just a file in SQLite, if other apps can't access that file you're good.
If you mean accessing it by tinkering with the filesystem, it's definitely possible on Android, unless you encrypt the file. On iOS it's a bit more difficult, but on a jailbroken phone it's entirely possible as well.
You'd want to research SQLite encryption libraries, but these are different on iOS and Android. If you want a common approach, encrypt the file and decrypt it before access.
SQLCipher is a popular library for encrypting your db on Android.
You should definitely enable Proguard as well if you're worried about modifications to your app.
Is the data open to anyone (that knows how) to go in and make changes
to the database?
Yes:
Jailbroken iPhone,iPad.
Rooted Android device.
Is it possible to secure this data so that only the application can
access it?
Not really but you can make it harder to leak through encrypting all the sensitive informations. Note: Do not use an opensource Encryption/Decryption chances are that the hacker also knows about it and it will be used againts you. Implements your own Encryption and Decryption instead if you have time.

LocalStorage vs Sqlite database

I have a hybrid application which runs on Android and ios platform, I have been using "localStorage" as data storage.
I also heard sqlite as well, Is there any other local database that I can use for mobile storage?
I would like to know prop and cons in these technologies.
I would really appreciate if anyone can clarify about these technologies.
You can manage data or storage in Android by following ways,
Shared Preferences
Internal Storage
External Storage
SQLite Databases
Network Connection
You can manage the storage or data in iOS by following ways,
Property lists
SQLite database
Core Data
As you say that you have a hybrid application which is for Android and ios you should use SQLite database, because
It is light weight
Comfortable with both Android and iOS [ Cross platform ]
capacity to Handle huge data
The handling of code, manipulating the code is much easy with sqlite.
So, its my opinion to u that you should use SQLite as an database for hybrid application, it will be easy for you. If you are doing application only for iOS then core date can be another good option since you doing both one SQLite is best.
As far as we consider speed and performance , SQLITE is best according to docs.
but you can use xml data storage as well but you will find a little bit slow than sqlite.
Your options are limited. Shared Preferences, local storage, sqlite and network are your only options.
Everything you need to know about your options can be found at the official Storeage Options docs.
I recommend that if you only need to save user options and states and not lots of data then you only need to use Shared Preferences. You can even save JSON in the shared preferences if you don't want to setup a sqlite database.
And remember a user can wipe app data from the app settings, if your worried about the data being wiped then the only option is network or a combination with network.

How to encrypt shipped database in android?

Team,
I have an Android application with large SQLite database this data costs me lots of money and I don't want to let anybody have it easily.
This database come to me as databse.sqlite file and I shipped into into the APK assets.
is there anyway to encrypt this database before shipping and then decrypt while reading the data ?
P.S I searched for this a lot and all of my results point me to use sqlcipher but this lib does not work with shipped SQLite database file.
The problem is that you will need to store the key (or location of the key) somewhere in your code and deodexing the application doesn't take that much effort. Unfortunately, you can't really prevent anyone from accessing the data. You can only make it harder, but it will still be pretty easy for someon who is really determined.
The best solution would be to store the database on a server and only send the data the user actually needs to the device. That way you have at least some control over what data a device requests.

Is there a way to change the default SQLITE database location on an android phone, to a folder on an HPH website?

I have an app that stores a sqlite database in the usual place. ie: data/data/com.blah.blah/databases. I wish to remotely locate the SQLITE database and read from and write to it. I wonder if there is a way to do it without using the Oracle Mysql option. Is there a way to just change the default location to a folder on a website. Thanks in advance. If so how do I do it. I cant find any tuts or books that explain how its done.
SQLite isn't a remote database implementation. That is kind-of part-of white it is called SQ*Lite*. :) It is for doing SQL databases based on local files, without taking the big additional overhead of having some remoteable service protocol sitting between you and the database.
There are all kinds of options for interacting with remote data stores, not just MySQL - PostgreSQL, etc. You can use whatever of those you want. You can then have on the device just the client code you need to communicate with the remote data store. It doesn't make sense for Android to supply any complicated/sophisticated here built-in, though, since exactly what you want is going to depend mostly on what you are using on your back-end server.

Categories

Resources