I was using firebase till now and a friend recommended me to use Sqlite.. I was wondering if i setup a quiz in my app and it stores the data to my phone's sqlite... can others get access to it if my internet connection is fine? i used to use firebase for such a purpose but was wondering if sqlite can perform this function
Yes, others can get access to the data stored in that SQLite database. Here are just a couple of scenarios:
You store the SQLite database on external storage (e.g. a microSD card) and someone gets access to that microSD card. (E.g. you leave your phone unattended and someone removes the card.)
Someone gains physical access to your phone. (E.g. you turn it in for repairs without wiping the storage first.)
You store backups of your phone on your computer and someone gains access to those backups.
You store backups of your phone on an USB key and lose that USB key.
There is a security bug in Android that allows remote access to the phone's storage.
There is a security bug in the quiz app that allows remote access to app's storage.
These are just some of the ways in which someone can get access to that database.
Sqlite data is stored in your phone's storage (doesn't require internet) whereas firebase is cloud storage (requires internet). In both cases no one can see your data. If you are only making a quiz app i would recommend sqlite database as it will store the data in user's phone.
Sqlite database stored in internal storage of your app, so only your app can access to it. But if device have root, there are possibility to extract database.
Sqlite database was highly preferable if you are making a quiz app. Since it stores the data in user's device,I'm afraid that data can't be shared with other devices (until shared physically). And that won't be efficient for an application. I would prefer using parse server, for sharing those data over the internet with other devices.
Related
Offline application with user data that has to be saved on the device but also possible to delete app and reinstall on other device and use same data there.
Can room database be used fully offline?
Written in kotlin
So for my Android App which stores data of workouts I have been using a SQLite Database so far. Now I want to implement these features:
Offer workouts in real time (with Firebase Database)
Being able to access your data on other devices and maybe from an web app
later
I figured, that for this purpose Firebase would be a great fit. But switching from SQLite to Firebase would bring a few down sights in my opinion:
Every user would need to sign up. I think for some users this is a reason to
not use my app. There is no way to avoid having to sign up when using
Firebase to store the data for user, right?
I´m not sure how good the offline options of Firebase Database is. How long
will the data be accessible without a connection? Is the capacity and
performance comparable to a SQLite Database?
I thought an alternative way could be to use Firebase just for offering the workouts but keep the data about a workout (repetitions, weight, ...) in a SQLite Database. Then I could upload the Database File with Firebase and another Device could download and continue it. Could that be an option?
Any thoughts and advice are appreciated!
Every user would need to sign up. I think for some users this is a
reason to not use my app. There is no way to avoid having to sign up
when using Firebase to store the data for user, right?
Right. (Technically it is possible, however you will need to enable read / write operations to non registered uses which is a no-no and not recommended at all.)
I´m not sure how good the offline options of Firebase Database is. How
long will the data be accessible without a connection? Is the capacity
and performance comparable to a SQLite Database?
From the firebase database docs: Firebase apps automatically handle temporary network interruptions. Cached data is available while offline and Firebase resends any writes when network connectivity is restored..
So yes, you can continue writing to it even when offline and read the already cached data, but this does not solve your concern that users will have to register to use the app.
Possible solution
Use both SQLite and Firebase database:
For a registered user, always write in both SQLite and Firebase to keep them in sync (write in Firebase first and then SQLite). Another option is to write in SQLite and sync to Firebase every X minutes. Read data from Firebase when online and from SQLite when offline.
When the user is offline, you will to write data to SQLite. You will need to mark those records as non-synced so that next time it is connected you will write them to firebase.
Also, when reconnected, you'll need to somehow merge firebase data (that might have changed) and local SQLite data. The algorithm for this depends on your app.
For non-registered users, use SQLite only.
The downside to all this is that the complexity of your application increases a lot. It's up to you to decide whether it's worth it or not. :)
Is it possible to have a local shared SQLite database between different android apps where if the user removes any of the apps (including the first installed app) it won't delete the shared database?
I know that Content Providers are usually the way to go with sharing data between apps but my understanding is that a content provider and database will get uninstalled when the original installed program is uninstalled. Is this correct?
I realize that storing the data online solves the shared database problem but it also brings along problems like app slowness, connection issues, if the app grows large then large server fees, etc.
Is there a good solution here?
Is it possible to have a local shared SQLite database between different android apps where if the user removes any of the apps (including the first installed app) it won't delete the shared database?
You would have to put it on external storage. From a privacy and security standpoint, this is horrible. Plus, the user can delete it.
I know that Content Providers are usually the way to go with sharing data between apps but my understanding is that a content provider and database will get uninstalled when the original installed program is uninstalled. Is this correct?
Yes.
Is there a good solution here?
Have one app, rather than several apps.
I have created an android application with an SQLite database. However, I did not realize this was stored locally. Is there any way to connect the locally distributed SQLite database on personal devices to a global DB Server?
I need the database to be synchronized across all devices.
Depending on your requirements, there are several ways to achieve this.
Basically what you'll want is an API, which exposes the basic CRUD operations on your database. Your devices then interact with the API and store the data directly on the server.
The next step would be allowing the devices to save the data offline and sync it as soon as the device gets online. In this scenario, you'll need a local sqlite (or whatever) database in order to keep track of what changed on the device.
I would recommend you to read some stuff out there about synchronizing databases on mobile devices. Offline as well as online. You can find a basic explanation in this thread.
For my best knowledge so far, the biggest difference between SQLite and MySQL is that it does not require a server to run, as SQLite stores data in a database file in each device.
The question rising from this part is..
Let's say I created an Android app which simply contains login and signup features. By installing this app in one device I create an ID with a password (let's say the ID is ricoangeloni and the password is 1234).
If I install the app in another device, is it still possible to log in with the pre-made ID? This is still very confusing, as I am probably not sure if the clients are sharing the centre database.
The answer to this question depends on where the database is located (regardless of whether you're using SQLite or MySQL to access the database). If you're storing the database on the Android device, then that database is specific to that device.
If the database however is stored on some internet-facing computer (doesn't have to be a "server" per say) and your app interacts with that hosted database, then an account created in that database is accessible from anywhere, not just your app. A website for example could also use the accounts in that database for login purposes.
The approach of housing the database on the device does have its advantages, namely you don't need to have a dedicated machine to host the database. But, if you wanted to have one database with all of the accounts and use that for authentication purposes, you're going to need to put that database on the internet.