I'm trying to figure out an android app that stores user's data in a database on sdcard.
But I don't know if it's possible to have these too:
even if the user deletes the app, the db remains and the user can access it.
So later they can re-install and give the app the path to the db file. The app uses that file as a database again.
Something like WhatsApp db, but the user must have the database as a file on their phone so they can transfer and store it anywhere. The data is large so it's not a good idea to get a backup file.
Is it possible to create it with Room or SQLite? and reuse it again?
Related
I am storing my data in Realm DB, I wanted to know is it possible for a non-rooted phone user to see/edit this data or not ??
I am asking this as a security point of concern because when using Shared pref/SQLite on a non-rooted phone no one can see/edit the data.
If the user will be able to view the database depends on where you have saved the database. If you are not modifying the location of the database, then by default the realm database is stored at the same location as SQLite db. So, the user should not be able to view the file.
However, if you are placing the database in a custom folder accessible without root (like sdcard) the user will be able to view it.
For the safety purpose, you can encrypt the database. You can read more about it here
So i am writing a python3 app with kivy and i want to have some data stored in a database using sqlite.
The user needs to have access to that data from the first time he opens the app
Is there a way to possibly make it so that when i launch the app, the user that downloads it, will already have the data i stored, like distribute the database along with the app? so that i don't have to create it for every user.
I have searched here and there but haven't found an answer yet
Thank you in advance
Just include the database file in the apk, as you would any other file.
I am not quite getting the idea of sqlite database. I am developing a hybrid mobile app using Ionic Framework and backend with PHP.
I referrred to this article for using the sqlite https://blog.nraboy.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/
I have a few questions now,
1) So, anybody can create a table,insert and do any kind of operations? Is'nt there any need of a security method to access the DB like mysql?
2) Is a separate instance of Sqlite created for each application? Coz if not,I can make a guess for a tablename created by any other application and delete it all together,isn't it? I just dont get it?
1) SQLite is a file database so if you have access to file you have access to database and can do anything with it. What is the purpose of restricting access to db when you can just delete whole file? SQLite db file should be created in app private storage so no one have access to it only your app.
2) the answear is above. just create file in right place and everything will be fine :)
1) So, anybody can create a table,insert and do any kind of operations? Is'nt there any need of a security method to access the DB like mysql?
By default, each app db will store in their private folder(data/data/your_package_name/database and only that app or system app can access to it.
But if you choose to store your db in sdcard, anybody can mess up your db if they know the path to db file and have right to access it.
Other case is if your device is root, other apps can access your db too.
2) Is a separate instance of Sqlite created for each application? Coz if not,I can make a guess for a tablename created by any other application and delete it all together,isn't it? I just dont get it?
Like above, each app can choose where to store their db file, so basically, they a separate instance.
You can also create multi db file for one app if you like.
I using SQLite as my database.
Using the app, the user can save some item on the database.
But I would like also to update the database from time to time.
The problem is how can I update the database without affecting the user inserted data and in a manner that it will download the new database online and not by updating the app itself.
Since my comment is large, I'll post it as an answer.
You won't find any tutorial showing exactly what you're trying to accomplish, because what you need is somewhat complex (but not difficult)
First approach:
You need your app to query some webservice to find out if there's a newer version of the database, and if there is, download it
The database must be saved in some temporary location, then you transfer all the users saved data to the new database, and finally replace the apps database with the new database (already updated with user's data)
Another approach would be:
Make your app query some webservice to find if the database needs to be updated.
If yes, download the SQL commands to modify the database structure.
I am working on some application, where I am storing some of my application data in SQLite DB. If any user clears the data, my data gets cleared. Through How to disable the Clear Data button in Application info of Manage appliaction and http://groups.google.com/group/android-developers/browse_thread/thread/b1091f190f7356b7 these links, I found that we cannot disable clear data button, But my question is Is there any way to catch this action(clear data) in the application? Is there any intent in android to notify this action ?
Thanks in advance
Pushpa
A possible workaround is to program your application to use a SQLite database on external storage. SD card etc. just create a folder on your SD or whatever storage you want, place the .db file in that folder and use that instead of the default storage location. By default, SQLite databases are stored in the data folder(device not rooted so dont know where in the data folder), which is not accesible unless you rooted your device.
There are tutorials out there that use this technique.
Note that, its likely that when you delete your app, the data will persist.
Don't know if that is desirable.
You can do one thing You can create a test table in your DB and insert some data in it. Every time you run the application you check the value of the table exist or not. If data exist that means DB value is not reset and if Table is empty you get to know that DB data is cleared and insert the data again for the next time check.